Difference between revisions of "PERL/C2/Blocks-in-Perl/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 5: Line 5:
 
|-
 
|-
 
| 00:01
 
| 00:01
| પર્લમા ''' BLOCKS'''  પરનાં સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે
+
| પર્લમા ''' BLOCKS'''  પરનાં સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે.
  
 
|-
 
|-
Line 128: Line 128:
 
|-
 
|-
 
|02:08
 
|02:08
|and press  '''Enter.'''  
+
|અને  '''Enter.''' દબાઓ.
  
 
|-
 
|-
 
|02:10
 
|02:10
|This will open the ''' beginBlock dot pl ''' file in '''gedit. '''
+
| '''gedit. ''' મા  ''' beginBlock dot pl ''' ફાઈલ ખોલશે.
 
   
 
   
 
|-
 
|-
 
|02:15
 
|02:15
|Type the following piece of code as displayed on the screen.  
+
| સ્ક્રીન પર દશ્યમાન કોડ ટાઈપ કરો.
  
 
|-
 
|-
 
|02:20
 
|02:20
|Let us look at what I have written inside the script.  
+
| ચાલો જોઈએ મેં સ્ક્રીપ્ટ મા શું લખ્યું છે.
 
   
 
   
 
|-
 
|-
 
|02:24
 
|02:24
|Here, we have printed some text before and after ''' BEGIN''' blocks.  
+
| અહી આપણે ''' BEGIN''' બ્લોકસ ના આગળ અને પાછળ અમુક પ્રિન્ટ સ્ટેટમેંટ લખ્યું હતું.  
 
   
 
   
 
|-
 
|-
 
|  02:31
 
|  02:31
| Similarly, I have written one ''' print statement''' in each '''BEGIN''' block.  
+
| તેમજ મેં દરેક  '''BEGIN''' બ્લોકસ મા એક પ્રિન્ટ સ્ટેટમેંટ લખ્યું છે.  
  
 
|-
 
|-
 
|  02:37
 
|  02:37
|Please note, I have not given the semicolon after the ''' BEGIN''' blocks.  
+
| નોંધ લો કે મેં  ''' BEGIN''' બ્લોકસ પછી સેમીકોલન નથી આપ્યું.
  
 
|-
 
|-
 
| 02:42
 
| 02:42
|Putting a semicolon, will result in a syntax error, on execution of the program.  
+
| સેમીકોલન મુકતા, પ્રોગ્રામ ને એક્ઝીક્યુટ કરતી વખતે પરિણામ મા સિન્ટેક્સ એરર મળશે.
 
   
 
   
 
|-
 
|-
 
|02:49
 
|02:49
|Now, press ''' Ctrl+s''' to save the file.  
+
હવે ફાઈલ સેવ કરવા માટે ''' Ctrl+s''' દબાઓ.  
 
   
 
   
 
|-
 
|-
 
| 02:53
 
| 02:53
| Then switch to terminal and execute the script by typing,  
+
પછી ટર્મિનલ પર જાઓ અને સ્ક્રીપ્ટ એક્ઝીક્યુટ કરવા માટે ટાઈપ કરો,
 
   
 
   
 
|-
 
|-
Line 172: Line 172:
 
|-
 
|-
 
|03:01
 
|03:01
|and press '''Enter.'''
+
|અને '''Enter.''' દબાઓ.
 
   
 
   
 
|-
 
|-
 
|03:04
 
|03:04
|You will get the output as displayed on the terminal.  
+
| ટર્મિનલ પર દેખાય છે તે આઉટપુટ તમને મળશે.
 
   
 
   
 
|-
 
|-
 
|  03:09
 
|  03:09
| Notice that The line written inside the first '''BEGIN''' block gets printed first and
+
| નોંધ લો કે BEGIN''' બ્લોક મા લખેલ લાઈન પ્રથમ પ્રિન્ટ થાય છે અને
 
   
 
   
 
|-
 
|-
 
|03:16
 
|03:16
| The first '''print statement''' in the script actually gets printed after the '''BEGIN block statements. '''
+
| સ્ક્રીપ્ટમા પ્રથમ પ્રિન્ટ સ્ટેટમેંટ વાસ્તવમાં 'BEGIN block statements. ''' પછી પ્રિન્ટ થશે.
 
    
 
    
 
|-
 
|-
 
|  03:25
 
|  03:25
| '''BEGIN blocks''' gets executed in the order of their declaration.  
+
| '''BEGIN blocks''' તેના ડીકલેરે શન ક્રમમા એક્ઝ્ક્યુત થાય છે.  
  
 
|-
 
|-
 
|  03:31
 
|  03:31
| From this example, it is evident that:  
+
| આ ઉદાહરણથી તે સ્પષ્ટ થાય છે:
 
   
 
   
 
|-
 
|-
 
|  03:34
 
|  03:34
|The code written inside the ''' BEGIN'''  blocks gets executed first.  
+
| ''' BEGIN'''  બ્લોકસ મા લખેલ કોડ પ્રથમ એક્ઝીક્યુટ થાય છે.
 
   
 
   
 
|-
 
|-
 
| 03:40
 
| 03:40
| This is irrespective of the location of the ''' BEGIN''' block inside ''' PERL''' script.  
+
| આ પ્રલ સ્ક્રીપ્ટમા ''' BEGIN''' બ્લોકના પોજીશનપર અનપેક્ક્ષિત હોય છે.  
  
 
|-
 
|-
 
| 03:46
 
| 03:46
| '''BEGIN blocks''' always get executed in the '''First In First Out''' manner.  
+
| '''BEGIN blocks''' હમેશા '''First In First Out''' પદ્ધતિ થી એક્ઝીક્યુટ થાય છે.  
  
 
|-
 
|-
 
|03:52
 
|03:52
|So one of the use of this '''block''' is to include files inside a Perl script, before actual execution starts.  
+
| તે માટે આ બોલ્કનો એક ઉપયોગ પર્લ સ્ક્રીપ્ટના એક્ઝીક્યુશન શુરુ કરવાના પેહેલા તેમાં ફાઈલ સમાવિષ્ઠ કરવા માટે થાય છે.
  
 
|-
 
|-
 
|04:01
 
|04:01
|Now, let us understand the '''END block '''
+
| ચાલો હવે  '''END block ''' વિષે સમજીએ.
 
   
 
   
 
|-
 
|-

Revision as of 14:58, 17 October 2014

Time Narration
00:01 પર્લમા BLOCKS પરનાં સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે.
00:06 આ ટ્યુટોરીયલમાં આપણે પર્લમાં ઉપલબ્ધ વિવિધ બોલ્ક્સ વિશે શીખીશું;
00:13 અહીહું વાપરી રહ્યી છું ઉબુન્ટુ લીનક્સ 12.04 ઓપરેટીંગ સીસ્ટમ અને પર્લ Perl 5.14.2 .
00:21 હું gedit ટેક્સ્ટ એડીટર પણ વાપરીશ.
00:26 તમે તમારા પસંદનું કોઈપણ ટેક્સ્ટ એડીટર વાપરી શકો છો.
00:31 પૂર્વ જરૂરી રીતે તમને પર્લમા Variables, Comments વિષે સામાન્ય જાણકારી હોવી જોઈએ.
00:38 પર્લમા ડેટા સ્ટ્રક્ચરની જાણકારી હોવી વધુ ફાયદા કારક છે.
00:44 સ્પોકન ટ્યુટોરીયલ વેબસાઈટ પર સંદર્ભિત સ્પોકન ટ્યુટોરીયલોનો સંદર્ભ લો.
00:50 પર્લ 5 વિશિષ્ઠ બોલ્ક્સ પ્રદાન કરે છે.
00:53 આ બોલ્ક્સ પર્લ પ્રોગ્રામના વિવિધ તબક્કામાં એક્ઝીક્યુટ થાય છે.
00:59 બોક્લ્સ છે:
01:01 BEGIN
01:02 END
01:03 UNITCHECK
01:04 CHECK.
01:05 INIT
01:06 ચાલો BEGIN બોક્લને સમજવા થી શરુઆત કરીએ.
01:10 કમ્પાઇલેશન કરતી વખતે BEGIN બ્લોક એક્ઝીક્યુટ થાય છે.
01:15 તો, આ કોઇપણ કોડ જે બોલ્કમાં લખેલ તે કમ્પાઇલેશન કરતી વખતે પ્રથમ એક્ઝીક્યુટ થાય છે.
01:22 આપણી પાસે પર્લ સ્ક્રીપ્ટમા અનેક BEGIN બોલ્કસ છે.
01:26 આ બોલ્ક્સ ડીકલેરેશન ના ક્રમમાં એક્ઝીક્યુટ થશે.
01:31 First define First execute પેટર્ન છે.
01:35 BEGIN block માટે સિન્ટેક્સ આપ્યા પ્રમાણે છે.
01:40 કેપિટલ અક્ષરોમા BEGIN સ્પેસ ખુલ્લો છગડીયો કૌંસ
01:45 Enter. દબાઓ.
01:47 કમ્પાઇલેશન કરતી વખતે એક્ઝીક્યુટ કરવા માટે નો કોડ.
01:51 Enter દબાઓ.
01:52 બંદ ખુલ્લો છગડીયો કૌંસ
01:55 ચાલો હવે 'BEGIN બ્લોકસ ઉદાહરણ જોઈએ.
01:59 ટર્મિનલ ખોલો અને ટાઈપ કરો.
02:02 gedit beginBlock dot pl space ampersand
02:08 અને Enter. દબાઓ.
02:10 gedit. મા beginBlock dot pl ફાઈલ ખોલશે.
02:15 સ્ક્રીન પર દશ્યમાન કોડ ટાઈપ કરો.
02:20 ચાલો જોઈએ મેં સ્ક્રીપ્ટ મા શું લખ્યું છે.
02:24 અહી આપણે BEGIN બ્લોકસ ના આગળ અને પાછળ અમુક પ્રિન્ટ સ્ટેટમેંટ લખ્યું હતું.
02:31 તેમજ મેં દરેક BEGIN બ્લોકસ મા એક પ્રિન્ટ સ્ટેટમેંટ લખ્યું છે.
02:37 નોંધ લો કે મેં BEGIN બ્લોકસ પછી સેમીકોલન નથી આપ્યું.
02:42 સેમીકોલન મુકતા, પ્રોગ્રામ ને એક્ઝીક્યુટ કરતી વખતે પરિણામ મા સિન્ટેક્સ એરર મળશે.
02:49

હવે ફાઈલ સેવ કરવા માટે Ctrl+s દબાઓ.

02:53 પછી ટર્મિનલ પર જાઓ અને સ્ક્રીપ્ટ એક્ઝીક્યુટ કરવા માટે ટાઈપ કરો,
02:58 perl beginBlock dot pl
03:01 અને Enter. દબાઓ.
03:04 ટર્મિનલ પર દેખાય છે તે આઉટપુટ તમને મળશે.
03:09 નોંધ લો કે BEGIN બ્લોક મા લખેલ લાઈન પ્રથમ પ્રિન્ટ થાય છે અને
03:16 સ્ક્રીપ્ટમા પ્રથમ પ્રિન્ટ સ્ટેટમેંટ વાસ્તવમાં 'BEGIN block statements. પછી પ્રિન્ટ થશે.
03:25 BEGIN blocks તેના ડીકલેરે શન ક્રમમા એક્ઝ્ક્યુત થાય છે.
03:31 આ ઉદાહરણથી તે સ્પષ્ટ થાય છે:
03:34 BEGIN બ્લોકસ મા લખેલ કોડ પ્રથમ એક્ઝીક્યુટ થાય છે.
03:40 આ પ્રલ સ્ક્રીપ્ટમા BEGIN બ્લોકના પોજીશનપર અનપેક્ક્ષિત હોય છે.
03:46 BEGIN blocks હમેશા First In First Out પદ્ધતિ થી એક્ઝીક્યુટ થાય છે.
03:52 તે માટે આ બોલ્કનો એક ઉપયોગ પર્લ સ્ક્રીપ્ટના એક્ઝીક્યુશન શુરુ કરવાના પેહેલા તેમાં ફાઈલ સમાવિષ્ઠ કરવા માટે થાય છે.
04:01 ચાલો હવે END block વિષે સમજીએ.
04:04 END block get executed at the end of PERL program
04:09 Code written inside this block gets executed after PERL has finished executing the program.
04:17 We can have several END blocks inside a Perl script.
04:21 These blocks will get executed in reverse order of declaration
04:26 That is, in Last define First execute pattern.
04:30 The syntax for END block is as follows
04:35 END in capital letters open curly bracket
04:39 Press Enter
04:40 Piece of code to be executed at the end of the PERL script
04:45 Press Enter
04:46 Close curly bracket
04:49 Now let us look at an example of END blocks.
04:53 Open the Terminal and type
04:56 gedit endBlock dot pl space ampersand
05:00 and press Enter
05:03 This will open the endBlock dot pl file in gedit.
05:08 Type the following piece of code as displayed on the screen.
05:13 Let us look at what I have written inside this script.
05:17 Here we have printed some text before and after END blocks.
05:23 Similarly, we have written one print statement in each END block.
05:29 Please note, I have not given the semicolon after the END block.
05:34 If we give the semicolon, there will be a syntax error on compilation.
05:41 Now, press Ctrl+s to save the file.
05:45 Then switch to terminal and execute the script by typing,
05:50 perl endBlock dot pl
05:53 and press Enter.
05:55 You will get the output as displayed on the terminal.
06:00 Notice that : The line written inside the END block is printed last.
06:06 The last print statement in the script actually gets printed before the END block statements and
06:13 END blocks gets executed in the reverse order of their declaration.
06:20 From the example, it is evident that
06:23 The code written inside the END blocks get executed at the end.
06:29 This is irrespective of the location of the END block inside the PERL script and
06:36 END blocks gets executed in the Last In First Out manner.
06:41 So, one use of END block is to destroy objects created in the program, before exiting.
06:49 Similarly, PERL has UNITCHECK, CHECK and INIT blocks.
06:55 These blocks are used rarely by developers and are a bit difficult to understand.
07:02 So, I will be just briefing you about these blocks.
07:06 UNITCHECK, CHECK and INIT blocks are useful-
07:10 to catch the transition between compilation and execution phase of the main program and
07:18 to perform some checks or initialisation, after compilation and before execution
07:24 UNITCHECK and CHECK blocks runs in Last in First out manner
07:31 whereas INIT block runs in First In First Out manner.
07:37 The syntax for UNITCHECK block is as follows
07:41 UNITCHECK in capital letters space open curly bracket
07:46 Press Enter
07:48 Piece of code to be executed
07:50 Press Enter
07:52 Close curly bracket
07:54 The syntax for CHECK block is as follows
07:58 CHECK in capital letters space open curly bracket
08:03 Press Enter
08:04 Piece of code to be executed
08:07 Press Enter
08:08 Close curly bracket
08:11 The syntax for INIT block is as follows
08:15 INIT in capital letters space open curly bracket
08:20 Press Enter
08:21 Piece of code to be initialised
08:24 Press Enter
08:26 Close curly bracket
08:28 For better understanding, I recommend that you experiment with these blocks in your Perl scripts.
08:36 Let us summarize.
08:37 In this tutorial, we have learnt -
08:40 BEGIN and END blocks in detail and
08:44 Introduction to UNITCHECK, CHECK and INIT blocks
08:48 using sample programs
08:52 Here is assignment for you -
08:54 Type the below code inside a PERL script;
08:58 Execute the script and observe the output.
09:02 Watch the video available at the following link
09:06 It summaries the Spoken Tutorial project
09:09 If you do not have good bandwidth, you can download and watch it
09:14 The Spoken Tutorial Project Team Conducts workshops using spoken tutorials
09:20 Gives certificates to those who pass an online test
09:24 For more details, please write to contact at spoken hyphen tutorial dot org
09:32 Spoken Tutorial Project is a part of the Talk to a Teacher project
09:37 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
09:45 More information on this Mission is available at spoken hyphen tutorial dot org slash NMEICT hyphen Intro
09:57 Hope you enjoyed this Perl tutorial.
10:00 This is Amol signing off.
10:02 Thanks for joining.

Contributors and Content Editors

Jyotisolanki, PoojaMoolya