Difference between revisions of "PERL/C3/Access-Modifiers-in-PERL/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(7 intermediate revisions by one other user not shown)
Line 10: Line 10:
 
|-
 
|-
 
|00:07
 
|00:07
|આ ટ્યુટોરીયલમાં આપણે આપણે શીખીશું:
+
|આ ટ્યુટોરીયલમાં આપણે   શીખીશું:
* Scope of variables
+
Scope of variables,
* '''Private''' variables
+
'''Private''' variables,
* '''Dynamically scoped''' variables
+
'''Dynamically scoped''' variables,
* '''Global''' variables
+
'''Global''' variables
  
 
|-
 
|-
 
|00:19
 
|00:19
 
|આ ટ્યુટોરીયલ  માટે હું ઉપયોગ કરી રહી છું:
 
|આ ટ્યુટોરીયલ  માટે હું ઉપયોગ કરી રહી છું:
* '''Ubuntu Linux 12.04''' operating system
+
'''Ubuntu Linux 12.04''' operating system,
* '''Perl 5.14.2''' અને  
+
'''Perl 5.14.2''' અને ,
* '''gedit''' Text Editor.
+
'''gedit''' Text Editor.
  
 
|-
 
|-
Line 69: Line 69:
 
|-
 
|-
 
|01:28
 
|01:28
| તમે આપેલ પ્રકારની વેલ્યુ આપ્યા વગર એક વેરીએબલ ડીકલેર કરી શકો છો.
+
| તમે આપેલ પ્રકારની વેલ્યુ આપ્યા વગર એક વેરીએબલ ડીકલેર કરી શકો છો. '''my $fvalue<nowiki> semicolon </nowiki>'''
'''my $fvalue<nowiki> semicolon </nowiki>'''
+
  
 
|-
 
|-
Line 142: Line 141:
 
|-
 
|-
 
|03:32
 
|03:32
|હવે ફાઈલને સેવ કરવા માટે ''' Ctrl+S'''  દબાવો.
+
|હવે ફાઈલને સેવ કરવા માટે ''' Ctrl+S'''  દબાવો.
  
 
|-
 
|-
Line 155: Line 154:
 
|03:49
 
|03:49
 
|આઉટપુટ આપેલ ની જેમ દેખાય છે:
 
|આઉટપુટ આપેલ ની જેમ દેખાય છે:
"Block 1: Raghu"
+
"Block 1: Raghu",
  
"Block 2: Other"
+
"Block 2: Other",
  
 
"Outside Block: " માં કોઈ પણ આઉટપુટ નથી.
 
"Outside Block: " માં કોઈ પણ આઉટપુટ નથી.
Line 171: Line 170:
 
|-
 
|-
 
| 04:10
 
| 04:10
| હવે છેલ્લા પ્રિન્ટ સ્ટેટમેંટ પહેલા બ્લોકસના ભાર ઉમેરીએ  ''' my $fname = ડબલ કોટસમાં '''John semicolon'''  
+
| હવે છેલ્લા પ્રિન્ટ સ્ટેટમેંટ પહેલા બ્લોકસના બહાર ઉમેરીએ  ''' my $fname = ડબલ કોટસમાં '''John semicolon'''  
  
 
|-
 
|-
Line 179: Line 178:
 
|-
 
|-
 
| 04:28
 
| 04:28
|Analyze the output that is displayed.
+
| દ્રશ્યમાન આઉટપુટ નું અવલોકન કરો.  
  
 
|-
 
|-
 
| 04:32
 
| 04:32
| Hope you are able to understand the scope of using 'my' variable within a block and outside a block.
+
| આશા છે તમે  ''''my''''  વેરીએબલ ઉપયોગ કરીને બ્લોક માં અને બ્લોકથી બહાર સ્કોપને સમઝવા માટે સક્ષમ છો.
  
 
|-
 
|-
 
| 04:41
 
| 04:41
| Next, we will see about '''dynamically scoped variable''' in '''Perl'''.
+
| આગળ આપણે '''Perl''' માં  '''dynamically scoped variable''' ના વિષે જોશું.
  
 
|-
 
|-
 
|04:47
 
|04:47
|'''Local''' keyword gives a temporary scope to a '''global''' variable.
+
| લોકલ કીવર્ડ  '''global''' વેરીએબલને એક અસ્થાયી સ્કોપ આપે છે.
  
 
|-
 
|-
 
| 04:52
 
| 04:52
| The variable is visible to any '''function''' called from the original block.
+
| તે વેરીએબલ અસલ બ્લોકથી કોલ થયેલ કોઈ પણ ફંકશન પર દ્રશ્યમાન થાય છે.  
  
 
|-
 
|-
 
|04:58
 
|04:58
|You can declare a '''local''' variable as:
+
| તમે આપેલની જેમ  '''local''' વેરીએબલને ડીકલેર કરી શકો છો:
  
'''local $fValue = 100 semicolon'''
+
'''local $fValue = 100 semicolon''', '''local $fname”''' =   '''double quotes ''' માં '''Rakesh''' semicolon
 
+
'''local $fname”''' = within double quotes '''Rakesh''' semicolon
+
  
 
|-
 
|-
 
|05:13
 
|05:13
|Let us understand this using a sample program.
+
| હવે એક સેમ્પલ પ્રોગ્રામનો ઉપયોગ કરીને આને સમઝાવીએ.
  
 
|-
 
|-
 
|05:17
 
|05:17
|Open the '''terminal''' and type: '''gedit scope hyphen local dot pl ampersand''' and press '''Enter'''.
+
| ટર્મિનલ ખોલો અને ટાઈપ કરો: '''gedit scope hyphen local dot pl ampersand''' અને  '''Enter''' દબાવો.
  
 
|-
 
|-
 
|05:27
 
|05:27
|This will open''' scope hyphen local dot pl''' file in''' gedit'''.
+
| ''' gedit''' માં ''' scope hyphen local dot pl''' ફાઈલને ખોલશે.
  
 
|-
 
|-
 
| 05:33
 
| 05:33
| Type the following code as displayed on the screen. Let me explain the code now.
+
| સ્ક્રીન પર પ્રદશિતની જેમ કોડ ટાઈપ કરો. ચાલો હું કોડ સમઝાવું.
  
 
|-
 
|-
 
|05:40
 
|05:40
|Here, in the first line, we have declared a variable '''$fname '''and initialized it.
+
| અહી પહેલી લાઈન માં આપણે એક વેરીએબલ  '''$fname ''' ને ડીકલેર કર્યું છે અને આને ઈનીશીલાઈઝ કર્યું છે.  
  
 
|-
 
|-
 
|05:47
 
|05:47
|Inside the function '''Welcome()''', we have declared a '''local''' variable by the same name,''' $fname.'''
+
|ફંકશન  '''Welcome()''' માં આપણે તેજ નામ ''' $fname.''' થી એક  '''local''' વેરીએબલને ડીકલેર કર્યું છે.
  
 
|-
 
|-
 
| 05:54
 
| 05:54
| Notice the '''local''' keyword before the variable name
+
| વેરીએબલના નામના આગળ  '''local''' કીવર્ડ પર ધ્યાન આપો.
  
 
|-
 
|-
 
| 05:59
 
| 05:59
| and we have assigned the value "Rakesh" to this variable.
+
| અને આપણે આ વેરીએબલને વેલ્યુ  '"Rakesh"' અસાઇન કરી છે.
  
 
|-
 
|-
 
| 06:03
 
| 06:03
| So, basically, inside function '''Welcome(), $fname''' is modified as a new temporary '''local''' variable.
+
|   તો; મૂળભૂત ફંકશન  '''Welcome(),માં  $fname''' એક અસ્થાયી લોકલ વેરીએબલની જેમ સુધારિત થાય છે. પછી ફંકશન  '''Hello() ''' કોલ કરવા માં આવે છે.
Then, the function '''Hello() '''is being '''call'''ed.
+
  
 
|-
 
|-
 
|06:15
 
|06:15
|Here is the function definition of '''Hello()'''.
+
| અહી '''Hello()''' નું ફંકશન ડેફીનેશન છે.
  
 
|-
 
|-
 
|06:18
 
|06:18
|At the end of the program, we are calling both the functions '''Welcome()''' and '''Hello()'''.
+
| પ્રોગ્રામના અંતમાં આપણે બંને ફંકશનસ  '''Welcome()''' અને  '''Hello()''' ને કોલ કરી રહ્યા છીએ.
  
 
|-
 
|-
 
|06:25
 
|06:25
|Now press''' Ctrl + S''' to save the program.
+
| હવે પ્રોગ્રામને સેવ કરવા માટે ''' Ctrl + S''' દબાવો.
  
 
|-
 
|-
 
|06:29
 
|06:29
|Let us execute the program.
+
| ચાલો પ્રોગ્રામને એક્ઝીક્યુટ કરીએ.
  
 
|-
 
|-
 
|06:31
 
|06:31
|Switch back to the '''terminal''' and type: '''perl scope hyphen local.pl''' and press '''Enter'''.
+
|ટર્મિનલ પર જાવ અને ટાઈપ કરો; '''perl scope hyphen local.pl''' અને  '''Enter''' દબાવો.
  
 
|-
 
|-
 
|06:41
 
|06:41
|The output is displayed as:
+
| આઉટપુટ આપેલની જેમ દેખાય છે: "Hello, Rakesh"!
"Hello, Rakesh"!
+
 
"Hello, Welcome to Spoken tutorials!"
 
"Hello, Welcome to Spoken tutorials!"
  
 
|-
 
|-
 
|06:48
 
|06:48
|Let us understand the output.
+
| ચાલો આઉટપુટ ને સમઝીએ.  
  
 
|-
 
|-
 
|06:51
 
|06:51
|When the function '''Welcome()''' is called, the function '''Hello()''' within it, accesses the '''local''' variable.
+
| જયારે ફંકશન  '''Welcome()''' કોલ થાય છે તો તેના અંદર ફંકશન '''Hello()''' '''local''' વેરીબ્લ એક્સેસ કરે છે.
  
 
|-
 
|-
 
| 06:59
 
| 06:59
|Within '''Welcome(), $fname''' has the value "Rakesh".
+
| '''Welcome(),માં  $fname''' વેલ્યુ  '"Rakesh"' ધરાવે છે.
  
 
|-
 
|-
 
| 07:04
 
| 07:04
|After this, the function '''Hello() '''accesses the variable '''$fname '''once again.
+
| તે પછી ફંકશન '''Hello() ''' વેરીએબલ  '''$fname ''' ને ફરી એક્સેસ કરે છે.
  
 
|-
 
|-
 
| 07:11
 
| 07:11
|But this time, it is the variable '''$fname '''which was initialized to "Welcome to spoken tutorials".
+
| પણ આ વખતે, આ વેરીએબલ '''$fname ''' છે જે '"Welcome to spoken tutorials"' થી ઈનીશીલાઈઝ થયું હતું.  
  
 
|-
 
|-
 
| 07:19
 
| 07:19
|It does not access the local variable '''$fname '''within the function '''Welcome()'''.
+
| આ ફંકશન '''Welcome()''' માં લોકલ વેરીએબલ '''$fname ''' ને એક્સેસ નથી કરતું.
  
 
|-
 
|-
 
| 07:25
 
| 07:25
|Which means that, the local variable restores the '''scope''', after leaving the block '''Welcome()'''.
+
| જેનો અર્થ છે કે બ્લોક '''Welcome()'''. ને છોડવા પછી લોકલ વેરીએબલ  '''scope''' ને રિસ્ટોર કરે છે.
 +
 
 
|-
 
|-
 
| 07:32
 
| 07:32
| Next, we will see about '''global''' variables in '''Perl'''.
+
| આગળ આપણે '''Perl''' માં '''global''' વેરીએબલ વિષે શીખીશું.
  
 
|-
 
|-
 
|07:38
 
|07:38
|A '''global variable '''can be accessed anywhere in the program.
+
|   એક  '''global variable ''' પ્રોગ્રામમાં ક્યાં પણ એક્સેસ કરી શકાય છે.
  
 
|-
 
|-
 
|07:43
 
|07:43
|'''Global variables '''are declared with 'our' keyword.
+
|'''Global variables ''' એ  '''our'''' કીવર્ડ સાથે ડીકલેર થાય છે.  
  
 
|-
 
|-
 
| 07:47
 
| 07:47
|Here are some examples.
+
| અહી અમુક ઉદાહરણ છે. '''our $fvalue = 100 semicolon </nowiki>'''
'''our $fvalue = 100 semicolon </nowiki>'''
+
'''our $fname = '''double quotes ''' માં Priya semicolon'''
'''our $fname =within double quotes Priya semicolon'''
+
  
 
|-
 
|-
 
|08:01
 
|08:01
|Now, let us look at a working example of '''global''' variables.
+
| હવે '''global''' વેરીએબલનું એક કાર્યરત ઉદાહરણ જોઈએ.
  
 
|-
 
|-
 
|08:06
 
|08:06
|Switch back to the '''terminal '''and type: '''gedit scope hyphen our dot pl ampersand''' and press''' Enter'''.
+
| હવે ટર્મિનલ પર જાવ અને ટાઈપ કરો: '''gedit scope hyphen our dot pl ampersand''' અને press''' Enter'''.
  
 
|-
 
|-
 
|08:16
 
|08:16
|This will open the file''' scope hyphen our.pl''' in '''gedit'''.
+
| '''gedit''' માં ''' scope hyphen our.pl''' ફાઈલ ખોલશે.
 
+
 
|-
 
|-
 
| 08:22
 
| 08:22
|Let me explain the sample program which I have written.
+
| હવે હું તે સેમ્પલ પ્રોગ્રામ સમઝાવિશ જે મેં લખ્યું છે.
  
 
|-
 
|-
 
|08:27
 
|08:27
|I have declared '''package main '''and a global variable as''' our $i '''and I have initialized it to '''100'''.
+
|મેં  '''package main ''' અને  ''' our $i '' ની જેમ એક ગ્લોબલ વેરીએબલ ડીકલેર  કર્યું છે, અને તેને  '''100''' થી ઈનીશીલાઈઝ કર્યું છે.  
  
 
|-
 
|-
 
|08:37
 
|08:37
|Notice the''' package First''' declaration.
+
| ''' package First''' ડીકલેરેશન ની નોધ લો.
  
 
|-
 
|-
 
| 08:40
 
| 08:40
|A '''package''' is a collection of code which has its own '''namespace'''.
+
| '''package''' કોડનું સંગ્રહ છે જે પોતાનું  '''namespace''' ધરાવે છે.
  
 
|-
 
|-
 
| 08:46
 
| 08:46
|'''Namespace''' prevents '''variable name collisions''' between '''packages'''.
+
| '''Namespace''' પેકેજસ ના વચ્ચે વેરીએબલ નેમના અથડામણ ને રોકે છે.  
  
 
|-
 
|-
 
| 08:51
 
| 08:51
|We will see more about '''package''' and '''namespace''' in future tutorials.
+
| આપણે '''package''' અને  '''namespace''' ના વિષે વધુ આગળના ટ્યુટોરિયલસ માં જોશું.
 
+
 
|-
 
|-
 
|08:56
 
|08:56
|Within '''package First,''' the global variable "i" holds the value 10.
+
| '''package First,''' માં ગ્લોબલ વેરીએબલ  "i" વેલ્યુ '''10.''' રાખે છે.
  
 
|-
 
|-
 
|09:02
 
|09:02
|In '''package Second,''' the global variable "i" is assigned the value 20.
+
| '''package Second,''' માં ગ્લોબલ વેરીએબલ  "i" ને વેલ્યુ ''' 20.''' અસાઇન  કરવામાં આવે છે.
  
 
|-
 
|-
 
|09:08
 
|09:08
|The main '''package '''uses both '''package First variable '''and the '''package Second variable'''.
+
| મેં પેકેજ  '''package First variable '' અને  '''package Second variable''' બંને નો ઉપયોગ કરે છે.
  
 
|-
 
|-
 
| 09:15
 
| 09:15
|In my program, I have declared the same variable "i" in all the '''packages'''.
+
|મેં  મારા પ્રોગ્રામમાં મારા બધા પેકેજમાં  સમાન વેરીએબલ  "i" ડીકલેર કર્યું છે.
  
 
|-
 
|-
 
| 09:21
 
| 09:21
|The '''package variable''' is referred by '''package name colon colon variable name'''.
+
| '''package variable''' એ  '''package name colon colon variable name''' થી ઉલેખિત થાય છે.
 
+
 
|-
 
|-
 
| 09:29
 
| 09:29
|In our example, it is''' $First colon colon i, $Second colon colon i'''.
+
| આપણા ઉદાહરણમાં આ ''' $First colon colon i, $Second colon colon i''' છે.
  
 
|-
 
|-
 
| 09:39
 
| 09:39
|We have multiple '''packages '''within one file and the global variable will be accessed by all the '''packages'''.
+
| આપણી પાસે એક ફાઈલમાં વિવિધ '''packages ''' છે અને ગ્લોબલ વેરીએબલ બધા પેકેજીસ થી એક્સેસ કરાવશે.
  
 
|-
 
|-
 
|09:47
 
|09:47
|Now, save the file and execute the program.
+
| હવે ફાઈલને સેવ કરો અને પ્રોગ્રામને એક્ઝીક્યુટ કરો.
  
 
|-
 
|-
 
|09:51
 
|09:51
|So, switch to '''terminal '''and type: '''perl scope hyphen our dot pl''' and press '''Enter'''.
+
| તો ટર્મિનલ પર જાવ અને ટાઈપ કરો  '''perl scope hyphen our dot pl''' અને એન્ટર દબાવો.
  
 
|-
 
|-
 
| 09:59
 
| 09:59
|The output is as displayed on the '''terminal'''.
+
| '''terminal'''. પર આઉટપુટ પ્રદશિત થાય છે.
  
 
|-
 
|-
 
|10:03
 
|10:03
|Analyze the output by yourself to understand how the assignment to the '''variable i '''was done.
+
| આઉટપુટ નું પોતેથી અન્વેષણ કરો આ સમઝવા માટે કે  '''variable i ''' પર અસાઇનમેન્ટ કેવી રીતે કરવામાં આવ્યા હતા.
  
 
|-
 
|-
 
|10:11
 
|10:11
|This brings us to the end of this tutorial. Let us summarize.
+
| અહી આ ટ્યુટોરીયલ સમાપ્ત થાય છે. ચાલો સારાંશ લઈએ.
  
 
|-
 
|-
 
| 10:16
 
| 10:16
|In this tutorial, we learnt:
+
|આ ટ્યુટોરીયલ માં, આપણે શીખ્યા:
* scope of variables
+
scope of variables, declaration of '''private variables''''''dynamically scoped variables''' અને '''global variables''' with examples.<br/>  
* declaration of '''private variables'''
+
* '''dynamically scoped variables''' and
+
* '''global variables''' with examples.<br/>  
+
  
 
|-
 
|-
 
| 10:29
 
| 10:29
|It is preferred to use 'my' than '''local''', as the compilation is faster.
+
| કમ્પાઈલેશન ઝડપથી થવા માટે  '''local''' ના બદલે '''my''' ઉપયોગ કરવાનું પ્રાધાન્ય આપવા માં આવે છે.
  
 
|-
 
|-
 
|10:35
 
|10:35
|Here is an assignment for you.
+
|અહીં તમારા માટે એક અસાઇનમેન્ટ છે.
  
 
|-
 
|-
 
| 10:37
 
| 10:37
|Write the code for the following assignment and execute it.
+
|આપેલ અસાઇનમેન્ટ માટે કોડ લખો અને તેને એક્ઝીક્યુટ કરો.
 
+
 
|-
 
|-
 
| 10:42
 
| 10:42
| Declare a '''package''' as '''FirstModule'''.
+
| '''FirstModule''' તરીકે '''package''' ને ડીકલેર કરો.  
  
 
|-
 
|-
 
| 10:46
 
| 10:46
| Declare a variable '''$age''' as '''our''' and assign the value '''42'''.
+
| '''our''' ની જેમ એક વેરીએબલ  '''$age''' ડીકલેર કરો અને વેલ્યુ '''42''' અસાઇન કરો.
  
 
|-
 
|-
 
| 10:52
 
| 10:52
|Declare another package as '''SecondModule'''.
+
| અન્ય પેકેજને '''SecondModule''' ની જેમ ડીકલેર કરો.
  
 
|-
 
|-
 
| 10:56
 
| 10:56
|Declare a variable '''$ageword''' as '''our''' and assign the value within double quotes "Forty-Two".
+
| '''our'''ની જેમ એક વેરીએબલ  '''$ageword''' ડીકલેર કરો અને ડબલ કોટસ માં વેલ્યુ "Forty-Two" અસાઇન કરો.
  
 
|-
 
|-
 
| 11:05
 
| 11:05
| Declare a subroutine''' First()'''.
+
| ''' subroutine''' ને  First()''' ડીકલેર કરો .  
  
 
|-
 
|-
 
| 11:08
 
| 11:08
| Inside the subroutine, declare two variables with '''local''' and '''my''' keyword as below:
+
| સબ રૂટીનમાં નીચે ની જેમ '''local''' અને  '''my''' કીવર્ડ ના સથે બે વેરીએબલસ ને ડીકલેર કરો .
  
 
|-
 
|-
Line 447: Line 435:
 
|-
 
|-
 
| 11:20
 
| 11:20
|'''my''' '''$ageword''' = within double quotes '''Fifty-two semicolon '''
+
|'''my''' '''$ageword''' = double quotes માં '''Fifty-two semicolon '''
  
 
|-
 
|-
 
| 11:27
 
| 11:27
|Call another subroutine as '''Result()'''.
+
| એક અન્ય સબ રૂટીન  '''Result()''' ને કોલ કરો.
  
 
|-
 
|-
 
| 11:31
 
| 11:31
|Print the values of '''$age''' and '''$ageword''' inside this function.
+
| આ ફંકશન માં '''$age''' અને  '''$ageword''' ની વેલ્યુઝ પ્રિન્ટ કરો.
  
 
|-
 
|-
 
| 11:37
 
| 11:37
|End the subroutine.
+
|સબ રૂટીન નો અંત કરો.
  
 
|-
 
|-
 
| 11:39
 
| 11:39
| Declare the subroutine '''Result()'''.
+
| સબ રૂટીન  '''Result()''' ડીકલેર કરો.
  
 
|-
 
|-
 
| 11:42
 
| 11:42
| Again print the values of '''$age''' and '''$ageword'''.
+
| ફરીથી '''$age''' અને  '''$ageword''' ની વેલ્યુને પ્રિન્ટ કરો.
  
 
|-
 
|-
 
| 11:47
 
| 11:47
| End the subroutine.
+
|સબ રૂટીન નો અંત કરો.
  
 
|-
 
|-
 
| 11:49
 
| 11:49
| Call the function '''First()'''.
+
| '''First()''' ને કોલ કરો.
  
 
|-
 
|-
 
| 11:51
 
| 11:51
| Print the '''Package First''' and '''Package Second''' as below:
+
| નીચે ની જેમ '''Package First''' અને  '''Package Second''' ને પ્રિન્ટ કરો:
  
 
|-
 
|-
 
|11:57
 
|11:57
|The video at the following link summarizes the '''Spoken Tutorial''' project.
+
|દર્શાવેલ લીંક પર ઉપલબ્ધ વિડીયો નિહાળો તે સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટનો સારાંશ આપે છે તમે વિડીયો ડાઉનલોડ કરીને જોઈ શકો છો.  
Please download and watch it.
+
  
 
|-
 
|-
 
|12:05
 
|12:05
|The '''Spoken Tutorial''' project team conducts workshops and gives certificates for those who pass an online test.
+
|સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટીમ : સ્પોકન ટ્યુટોરીયલોનાં ઉપયોગથી વર્કશોપોનું આયોજન કરે છે. જેઓ ઓનલાઈન પરીક્ષા પાસ કરે છે તેઓને પ્રમાણપત્રો આપે છે.વધુ વિગતો માટે અમને લખો .  
For more details, please write to us.
+
  
 
|-
 
|-
 
|  12:18
 
|  12:18
Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.
+
સ્પોકન ટ્યુટોરીયલ ને NMEICT, MHRD, ભારત સરકાર દ્વારા ફાળો આપવામાં આવ્યો છે.આ  મિશન પર વધુ જાણકારી આપેલ લીંક પર ઉપબ્ધ છે.
More information on this mission is available at this link.
+
  
 
|-
 
|-
 
|12:31
 
|12:31
|This is Nirmala Venkat from '''IIT Bombay''', signing off. Thanks for watching.
+
|આઈઆઈટી બોમ્બે તરફથી હું, જ્યોતી સોલંકી વિદાય લઉં છું. જોડાવા બદલ આભાર.  
  
 
|}
 
|}

Latest revision as of 18:08, 28 February 2017

Time
Narration
00:01 Spoken Tutorial on Access Modifiers in PERL પરના આ સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે.
00:07 આ ટ્યુટોરીયલમાં આપણે શીખીશું:

Scope of variables, Private variables, Dynamically scoped variables, Global variables

00:19 આ ટ્યુટોરીયલ માટે હું ઉપયોગ કરી રહી છું:

Ubuntu Linux 12.04 operating system, Perl 5.14.2 અને , gedit Text Editor.

00:32 તમે તમારી પસંદગી અનુસાર કોઈ પણ ટેક્સ્ટ એડિટર વાપરી શકો છો.
00:36 તમને Perl પ્રોગ્રામિંગ વિષે સામાન્ય જાણકારી હોવી જોઈએ.
00:40 જો નથી તો સ્પોકન ટ્યુટોરિયલ વેબ સાઈટ પર ઉપલબ્ધ Perl ટ્યુટોરિયલ જુઓ.
00:47 ચાલો scope of variables. ના પરિચય સાથે શરૂઆત કરીએ.
00:51 વેરીએબલ નું સ્કોપ કોડ નું એ શેત્ર છે. જેમાં વેરીએબલ ને એક્સેસ કરવામાં આવી શકે છે .
00:58 બીજા શબ્દ માં , આ વેરીએબલસ ની પ્રત્યક્ષતાને દેખાડે છે.
01:03 પ્રથમ આપણે Perl. માં my, local અને our modifiers ના વિષે ચર્ચા કરીશું.
01:10 my એટલેકે Private variables,
01:13 local એટલેકે Dynamically scoped variables,
01:17 our એટલેકે Global variables'.
01:20 વેરીએબલસ જે my કીવર્ડના સાથે ડીકલેર થયા છે બ્લોકના બહાર સ્કોપ સ્કોપ ને ગુમાવી દેશે જેમાં તે ડીકલેર થયા છે.
01:28 તમે આપેલ પ્રકારની વેલ્યુ આપ્યા વગર એક વેરીએબલ ડીકલેર કરી શકો છો. my $fvalue semicolon
01:37 તમે આને એક વેલ્યુ અસાઇન કરીને એક વેરીએબલ પણ ડીકલેર કરી શકો છો.
01:43 my $fValue = 1 semicolon
01:48 my $fname = ડબલ કોટ માં Rahul semicolon
01:55 તેજ my સ્ટેટમેંટ ના અસ્થે અનેક વેરીએબલસ ને ડીકલેર કરવા માટે સિન્ટેક્સ આપેલ આપેલ પ્રકાર છે.
02:02 my ખુલો કૌંસ $fname comma $lname comma $age બંદ કૌંસ
02:12 હવે એક સેમ્પલ પ્રોગ્રામનો ઉપયોગ કરીને private વેરીએબલસ ને સમઝીએ.
02:17 મારી પાસે પહેલાથી એક સેમ્પલ પ્રોગ્રામ છે. હું આને 'gedit Text editor માં ખોલીશ.
02:24 ટર્મિનલ ખોલો અને ટાઈપ કરો : gedit scope hyphen my dot pl ampersand અને Enter દબાવો.
02:34 Scope-my dot pl ફાઈલ હવે જી એડિટમાં ખુલે છે.
02:39 સ્ક્રીન પર પ્રદશિત આપેલની જેમ કોડ ટાઈપ કરો. ચાલો હું કોડ સમજાવું.
02:46 અહી મેં 'my' કીવર્ડ સાથે એક private વેરીએબલ $fname ને ડીકલેર કર્યું છે.
02:52 અને તેને "Raghu" વેલ્યુ અસાઇન કરી છે.
02:56 આ બ્લોકમાં print સ્ટેટમેંટ fname વેરીએબલ જેકે "Raghu" છે તેમાં વેલ્યુ પ્રિન્ટ કરે છે.
03:04 આગલા બ્લોકમાં હું તેજ private' વેરીએબલ $fname. ને '"Other"' વેલ્યુ અસાઇન કરી છે.
03:11 તો, પ્રિન્ટ સ્ટેટમેંટ આ વિશેષ બોલ્કમાં "Other" પ્રિન્ટ કરશે.
03:17 આ પ્રોગ્રામમાં છેલ્લે પ્રિન્ટ સ્ટેટમેંટ કોઈ આઉટપુટ પ્રિન્ટ નહી કરશે.
03:23 આવું એટલા માટે છે કેમકે પહેલા વ્યાખ્યાયિત બ્લોકસ ના સ્કોપના બહાર fname એ આના પર કોઈ વેલ્યુ અસાઇન નથી કરી.
03:32 હવે ફાઈલને સેવ કરવા માટે Ctrl+S દબાવો.
03:37 ચાલો હવે પ્રોગ્રામને એક્ઝીક્યુટ કરીએ.
03:40 ટર્મિનલ પર પાછા જાવ અને ટાઈપ કરો perl scope hyphen my dot pl અને Enter દબાવો.
03:49 આઉટપુટ આપેલ ની જેમ દેખાય છે:

"Block 1: Raghu",

"Block 2: Other",

"Outside Block: " માં કોઈ પણ આઉટપુટ નથી.

03:59 તો 'my' variable નું સ્કોપ ફક્ત કોડ ના એક વિશેષ બ્લોકમાં એક્સેસ થાય છે.
04:06 હવે વર્તમાન પ્રોગ્રામને થોડું બદલીએ.
04:10 હવે છેલ્લા પ્રિન્ટ સ્ટેટમેંટ પહેલા બ્લોકસના બહાર ઉમેરીએ my $fname = ડબલ કોટસમાં John semicolon
04:23 ટર્મિનલ પર પાછા જાવ અને પહેલાની જેમ એક્ઝીક્યુટ કરો.
04:28 દ્રશ્યમાન આઉટપુટ નું અવલોકન કરો.
04:32 આશા છે તમે 'my' વેરીએબલ ઉપયોગ કરીને બ્લોક માં અને બ્લોકથી બહાર સ્કોપને સમઝવા માટે સક્ષમ છો.
04:41 આગળ આપણે Perl માં dynamically scoped variable ના વિષે જોશું.
04:47 લોકલ કીવર્ડ global વેરીએબલને એક અસ્થાયી સ્કોપ આપે છે.
04:52 તે વેરીએબલ અસલ બ્લોકથી કોલ થયેલ કોઈ પણ ફંકશન પર દ્રશ્યમાન થાય છે.
04:58 તમે આપેલની જેમ local વેરીએબલને ડીકલેર કરી શકો છો:

local $fValue = 100 semicolon, local $fname” = double quotes માં Rakesh semicolon

05:13 હવે એક સેમ્પલ પ્રોગ્રામનો ઉપયોગ કરીને આને સમઝાવીએ.
05:17 ટર્મિનલ ખોલો અને ટાઈપ કરો: gedit scope hyphen local dot pl ampersand અને Enter દબાવો.
05:27 gedit માં scope hyphen local dot pl ફાઈલને ખોલશે.
05:33 સ્ક્રીન પર પ્રદશિતની જેમ કોડ ટાઈપ કરો. ચાલો હું કોડ સમઝાવું.
05:40 અહી પહેલી લાઈન માં આપણે એક વેરીએબલ $fname ને ડીકલેર કર્યું છે અને આને ઈનીશીલાઈઝ કર્યું છે.
05:47 ફંકશન Welcome() માં આપણે તેજ નામ $fname. થી એક local વેરીએબલને ડીકલેર કર્યું છે.
05:54 વેરીએબલના નામના આગળ local કીવર્ડ પર ધ્યાન આપો.
05:59 અને આપણે આ વેરીએબલને વેલ્યુ '"Rakesh"' અસાઇન કરી છે.
06:03 તો; મૂળભૂત ફંકશન Welcome(),માં $fname એક અસ્થાયી લોકલ વેરીએબલની જેમ સુધારિત થાય છે. પછી ફંકશન Hello() કોલ કરવા માં આવે છે.
06:15 અહી Hello() નું ફંકશન ડેફીનેશન છે.
06:18 પ્રોગ્રામના અંતમાં આપણે બંને ફંકશનસ Welcome() અને Hello() ને કોલ કરી રહ્યા છીએ.
06:25 હવે પ્રોગ્રામને સેવ કરવા માટે Ctrl + S દબાવો.
06:29 ચાલો પ્રોગ્રામને એક્ઝીક્યુટ કરીએ.
06:31 ટર્મિનલ પર જાવ અને ટાઈપ કરો; perl scope hyphen local.pl અને Enter દબાવો.
06:41 આઉટપુટ આપેલની જેમ દેખાય છે: "Hello, Rakesh"!

"Hello, Welcome to Spoken tutorials!"

06:48 ચાલો આઉટપુટ ને સમઝીએ.
06:51 જયારે ફંકશન Welcome() કોલ થાય છે તો તેના અંદર ફંકશન Hello() local વેરીબ્લ એક્સેસ કરે છે.
06:59 Welcome(),માં $fname વેલ્યુ '"Rakesh"' ધરાવે છે.
07:04 તે પછી ફંકશન Hello() વેરીએબલ $fname ને ફરી એક્સેસ કરે છે.
07:11 પણ આ વખતે, આ વેરીએબલ $fname છે જે '"Welcome to spoken tutorials"' થી ઈનીશીલાઈઝ થયું હતું.
07:19 આ ફંકશન Welcome() માં લોકલ વેરીએબલ $fname ને એક્સેસ નથી કરતું.
07:25 જેનો અર્થ છે કે બ્લોક Welcome(). ને છોડવા પછી લોકલ વેરીએબલ scope ને રિસ્ટોર કરે છે.
07:32 આગળ આપણે Perl માં global વેરીએબલ વિષે શીખીશું.
07:38 એક global variable પ્રોગ્રામમાં ક્યાં પણ એક્સેસ કરી શકાય છે.
07:43 Global variables our' કીવર્ડ સાથે ડીકલેર થાય છે.
07:47 અહી અમુક ઉદાહરણ છે. our $fvalue = 100 semicolon </nowiki>

our $fname = double quotes માં Priya semicolon

08:01 હવે global વેરીએબલનું એક કાર્યરત ઉદાહરણ જોઈએ.
08:06 હવે ટર્મિનલ પર જાવ અને ટાઈપ કરો: gedit scope hyphen our dot pl ampersand અને press Enter.
08:16 gedit માં scope hyphen our.pl ફાઈલ ખોલશે.
08:22 હવે હું તે સેમ્પલ પ્રોગ્રામ સમઝાવિશ જે મેં લખ્યું છે.
08:27 મેં package main અને our $i ની જેમ એક ગ્લોબલ વેરીએબલ ડીકલેર કર્યું છે, અને તેને 100' થી ઈનીશીલાઈઝ કર્યું છે.
08:37 package First ડીકલેરેશન ની નોધ લો.
08:40 package કોડનું સંગ્રહ છે જે પોતાનું namespace ધરાવે છે.
08:46 Namespace પેકેજસ ના વચ્ચે વેરીએબલ નેમના અથડામણ ને રોકે છે.
08:51 આપણે package અને namespace ના વિષે વધુ આગળના ટ્યુટોરિયલસ માં જોશું.
08:56 package First, માં ગ્લોબલ વેરીએબલ "i" વેલ્યુ 10. રાખે છે.
09:02 package Second, માં ગ્લોબલ વેરીએબલ "i" ને વેલ્યુ 20. અસાઇન કરવામાં આવે છે.
09:08 મેં પેકેજ package First variable અને package Second variable' બંને નો ઉપયોગ કરે છે.
09:15 મેં મારા પ્રોગ્રામમાં મારા બધા પેકેજમાં સમાન વેરીએબલ "i" ડીકલેર કર્યું છે.
09:21 package variablepackage name colon colon variable name થી ઉલેખિત થાય છે.
09:29 આપણા ઉદાહરણમાં આ $First colon colon i, $Second colon colon i છે.
09:39 આપણી પાસે એક ફાઈલમાં વિવિધ packages છે અને ગ્લોબલ વેરીએબલ બધા પેકેજીસ થી એક્સેસ કરાવશે.
09:47 હવે ફાઈલને સેવ કરો અને પ્રોગ્રામને એક્ઝીક્યુટ કરો.
09:51 તો ટર્મિનલ પર જાવ અને ટાઈપ કરો perl scope hyphen our dot pl અને એન્ટર દબાવો.
09:59 terminal. પર આઉટપુટ પ્રદશિત થાય છે.
10:03 આઉટપુટ નું પોતેથી અન્વેષણ કરો આ સમઝવા માટે કે variable i પર અસાઇનમેન્ટ કેવી રીતે કરવામાં આવ્યા હતા.
10:11 અહી આ ટ્યુટોરીયલ સમાપ્ત થાય છે. ચાલો સારાંશ લઈએ.
10:16 આ ટ્યુટોરીયલ માં, આપણે શીખ્યા:

scope of variables, declaration of private variables, dynamically scoped variables અને global variables with examples.

10:29 કમ્પાઈલેશન ઝડપથી થવા માટે local ના બદલે my ઉપયોગ કરવાનું પ્રાધાન્ય આપવા માં આવે છે.
10:35 અહીં તમારા માટે એક અસાઇનમેન્ટ છે.
10:37 આપેલ અસાઇનમેન્ટ માટે કોડ લખો અને તેને એક્ઝીક્યુટ કરો.
10:42 FirstModule તરીકે package ને ડીકલેર કરો.
10:46 our ની જેમ એક વેરીએબલ $age ડીકલેર કરો અને વેલ્યુ 42 અસાઇન કરો.
10:52 અન્ય પેકેજને SecondModule ની જેમ ડીકલેર કરો.
10:56 ourની જેમ એક વેરીએબલ $ageword ડીકલેર કરો અને ડબલ કોટસ માં વેલ્યુ "Forty-Two" અસાઇન કરો.
11:05 subroutine ને First() ડીકલેર કરો .
11:08 સબ રૂટીનમાં નીચે ની જેમ local અને my કીવર્ડ ના સથે બે વેરીએબલસ ને ડીકલેર કરો .
11:16 local $age = 52 semicolon
11:20 my $ageword = double quotes માં Fifty-two semicolon
11:27 એક અન્ય સબ રૂટીન Result() ને કોલ કરો.
11:31 આ ફંકશન માં $age અને $ageword ની વેલ્યુઝ પ્રિન્ટ કરો.
11:37 સબ રૂટીન નો અંત કરો.
11:39 સબ રૂટીન Result() ડીકલેર કરો.
11:42 ફરીથી $age અને $ageword ની વેલ્યુને પ્રિન્ટ કરો.
11:47 સબ રૂટીન નો અંત કરો.
11:49 First() ને કોલ કરો.
11:51 નીચે ની જેમ Package First અને Package Second ને પ્રિન્ટ કરો:
11:57 દર્શાવેલ લીંક પર ઉપલબ્ધ વિડીયો નિહાળો તે સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટનો સારાંશ આપે છે તમે વિડીયો ડાઉનલોડ કરીને જોઈ શકો છો.
12:05 સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટીમ : સ્પોકન ટ્યુટોરીયલોનાં ઉપયોગથી વર્કશોપોનું આયોજન કરે છે. જેઓ ઓનલાઈન પરીક્ષા પાસ કરે છે તેઓને પ્રમાણપત્રો આપે છે.વધુ વિગતો માટે અમને લખો .
12:18 સ્પોકન ટ્યુટોરીયલ ને NMEICT, MHRD, ભારત સરકાર દ્વારા ફાળો આપવામાં આવ્યો છે.આ મિશન પર વધુ જાણકારી આપેલ લીંક પર ઉપબ્ધ છે.
12:31 આઈઆઈટી બોમ્બે તરફથી હું, જ્યોતી સોલંકી વિદાય લઉં છું. જોડાવા બદલ આભાર.

Contributors and Content Editors

Jyotisolanki, PoojaMoolya