Difference between revisions of "PERL/C3/Sample-PERL-program/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 225: Line 225:
 
|-
 
|-
 
|05:30
 
|05:30
|Now, let us see - a '''Perl '''program '''weather underscore report dot pl ''' where we will make use of this '''module '''file '''Weather dot pm'''.
+
| હવે પર્લ પ્રોગ્રામ  '''weather underscore report dot pl ''' જોઈએ જ્યાં આપણે આ મોડ્યુલ ફાઈલ '''Weather dot pm''' નો ઉપયોગ કરીશું.
  
 
|-
 
|-
 
|05:40
 
|05:40
|Here, '''use strict''' and''' use warnings''' are compiler flags that help to avoid common programming mistakes.
+
| અહી  '''use strict''' અને ''' use warnings''' કમ્પાઈલ ફ્લેગ્સ છે જે સામાન્ય પ્રોગ્રામિંગ ની ભૂલોથી બચવા માટે મદદ કરે છે.
  
 
|-
 
|-
 
|05:48
 
|05:48
| '''use Weather''' semicolon. Here, '''Weather '''is a''' module''' name which I have used in this program.
+
| '''use Weather''' સેમીકોલન.અહી  '''Weather ''' એક મોડ્યુલ નામ છે જે મેં આ પ્રોગ્રામમાં ઉપયોગ કર્યો છે.
  
 
|-
 
|-
 
|05:56
 
|05:56
|We have already seen that the functions required for this program have been stored in this''' module'''.
+
| આપણે પહેલા જ જોયું કે આ પ્રોગ્રામ ના માટે આવશ્ક ફંકશન આ મોડ્યુલ માં સંગ્રહ કર્યું છે.
  
 
|-
 
|-
 
|06:03
 
|06:03
|It is not required to give the'''  dot pm''' file extension here.
+
| અહી'''  dot pm''' ફાઈલ  એક્સટેન્શન આપવાની જરૂરત નથી.
  
 
|-
 
|-
 
|06:08
 
|06:08
|In this program, I'll print different reports depending upon the given options.
+
| આ પ્રોગ્રામમાં હું આપેલ વિકલ્પો ના આધાર પર વિવિધ રીપોર્ટસ પ્રિન્ટ કરીશ.
  
 
|-
 
|-
 
|06:14
 
|06:14
|The user has to enter an option to print the  daily weather report of a particular week day,
+
|   આપેલ ને પ્રિન્ટ કરવા માટે યુઝરને એક વિકલ્પ ઉમેરવું પડશે.
daily weather report of a particular week day to an output file, weekly weather report.
+
 
 +
    વિશેષ વિકડે ની દૈનિક હવામાન રીપોર્ટ
 +
    આઉટપુટ ફાઈલ માં વિશેષ વિકડે ની દૈનિક હવામાન રીપોર્ટ
 +
    સાપ્તાહિક હવામાન રીપોર્ટ
 +
 
  
 
|-
 
|-
 
|06:27
 
|06:27
|If option '1' is typed, it will ask the user to enter the day of a week.
+
| જો વિકલ્પ '1' ટાઈપ થાય છે તો યુઝર થી અઠવાડિયાનો એક દિવસ ઉમેરવા માટે કહેશે.
  
 
|-
 
|-
 
|06:32
 
|06:32
|The '''diamond '''operator will read from''' STDIN''', that is, from the keyboard.
+
| '''diamond '''ઓપરેટર ''' STDIN''', થી વાંચશે જે એક કીબોર્ડ છે.  
  
 
|-
 
|-
 
|06:38
 
|06:38
|For example, if the user enters ''''monday'''', then it is assigned to a variable '''dollar dayoption, '''which is a''' local variable'''.
+
| ઉદાહરણના માટે જો યુઝર ''''monday'''' ઉમેરે છે તો આ વેરીએબલ '''dollar dayoption, ''' પર અસાઇન થાય છે જે એક લોકલ વેરીએબલ છે.
  
 
|-
 
|-

Revision as of 12:40, 5 February 2016

Time
Narration
00:01 Sample PERL program. ના સ્પોકન ટ્યુટોરીયલમાં તમારુ સ્વાગત છે.
00:06 આ ટ્યુટોરીયલમાં આપણે હમણા સુધી કવર કરેલ મુખ્ય વિષયોને સેમ્પલ પર્લ પ્રોગ્રામમાં સમાવેશ કરવાનું શીખીશું.
00:14 આ ટ્યુટોરીયલ રિકોર્ડ કરવા માટે હું ઉપયોગ કરી રહી છુ.
  • Ubuntu Linux 12.04 ઓપરેટીંગ સીસ્ટમ
  • Perl 5.14.2 અને
  • gedit ટેક્સ્ટ એડિટર.
00:25 તમે તમારી પસંદગી અનુસાર કોઈ પણ ટેક્સ્ટ એડિટર વાપરી શકો છો.
00:29 આ ટ્યુટોરીયલનાં અનુસરણ માટે તમને Perl પ્રોગ્રામિંગ ની સામાન્ય જાણકરી હોવી જોઈએ.
00:34 જો નથી, તો સંબંધિત ટ્યુટોરીયલો માટે, અમારી વેબસાઇટની મુલાકાત લો.
00:39 સેમ્પલ પર્લ પ્રોગ્રામ એક પ્રદેશ નું વિવિધ હવામાનના પૂર્વધારણા રીપોર્ટનું આઉટપુટ આપશે.
00:46 Weather dot pm એક મોડ્યુલ ફાઈલ છે જે આ પ્રોગ્રામના માટે એક જરૂરી ડેટા ને રાખવા માટે એક કોમ્પ્લેક્સ ડેટા સ્ટ્રક્ચર રાખે છે.
00:54 આ રીપોર્ટ બનાવવા માટે અનેક ફંકશન પણ રાખે છે.
00:59 Weather underscore report dot pl એ તે પર્લ પ્રોગ્રામ છે જે જરૂરી જરૂરી આઉટપુટ જોવા માટે આ મોડ્યુલનો ઉપયોગ કરે છે.
01:08 આપણી વેબ સાઈટ પર આ વિડીઓમાં તેજ કોડ ફાઈલ ઉપલબ્ધ છે.
01:13 કોડ ફાઈલ લીંકમાં આપેલ ફાઈલસ ને ડાઉનલોડ અને અનઝિપ કરો.
01:18 હવે આપણું પર્લ પ્રોગ્રામ Weather dot pm. જોઈએ.
01:24 આ પ્રોગ્રામમાં કોડ નું બ્લોક namespace Weather. માં છે.
01:29 પર્લ પેકેજ કીવર્ડ ઉપયોગ કરીને namespace અમલીકરણ કરે છે.
01:34 BEGIN બ્લોક main પ્રોગ્રામ થી પહેલા કમ્પાઈલ અને એક્ઝીક્યુટ કરાવાય છે.
01:40 Export યુઝરના namespace પર મોડ્યુલસ ના વેરીએબલ અને ફંકશન ને એક્સપોર્ટ કરવાની પરવાનગી આપે છે.
01:48 At the rate EXPORT અને at the rate EXPORT underscore OK એક્સપોર્ટ ઓપરેશન ના દરમિયાન ઉપયોગ થયેલ બે મેઈન વેરીએબલસ છે
01:57 At the rate EXPORT સબરૂટીન ની યાદી અને મોડ્યુલ ના વેરીએબલસ ધરાવે છે.


02:03 આ કોલર namespace. માં એક્સપોર્ટ કરાવશે.
02:07 At the rate EXPORT underscore OK જરૂરિયાત અનુસાર સિમ્બોલને એક્સપોર્ટ કરે છે.
02:14 અહી હવામાનના રીપોર્ટ માટે જરૂરી ડેટા રાખવા માટે કોપ્લેક્સ ડેટા- સ્ટ્રક્ચર બનાવવા માટે મેં references ઉપયોગ કર્યું છે.
02:24 $weather_report hash reference છે . “place” અને “nstate” સ્કેલ વેલ્યુ ધરાવે છે.
02:32 weekly” એ hash references નું હેશ છે.
02:37 *Each week day has four keys - અઠવાડિયા પ્રત્યેક દિવસ ચાર કી ધરાવે છે.
 max underscore temp, 
 min underscore temp, 
 sunrise,
 sunset.
02:48 record underscore time” બે ઇન્ડેક્સ વેલ્યુના સાથે એક array reference છે.


02:54 મારો પાસે વિવિધ વિકલ્પોના હવામાનના રીપોર્ટ ને દેખાડવા મતે અમુક સબરૂટીન છે.

એકે-એક કરીને તેને જોઈએ.

03:01 આ ફંકશન હેડર જાણકારી જેમકે report, place, state અને current date. ના હેડરને પ્રિન્ટ કરે છે.
03:10 હવે આગળનું ફંકશન display underscore daily underscore report. દેખાડે છે.
03:16 આ ફંકશન weekday input. ના આધાર પર સ્ક્રીન પર દૈનિક રીપોર્ટ પ્રિન્ટ કરે છે.
03:22 આપણે shift ફંકશન પ્રયોગ કરીને subroutine માં પાસ કરેલ પેરામીટર ને ફરી: મેળવીએ છીએ.
03:27 મેં પેરામીટર વેલ્યુના મુખ્ય અને અનુગામી સ્પેસે ને કાઢવા માટે trim() ફંકશન નો ઉપયોગ કર્યો છે.
03:34 અહી trim() ફંકશન માટે કોડ છે.
03:37 Lc() ફંકશન આપેલ ઈનપુટનું લોવરકેસ વર્જન રીટર્ન કરે છે.
03:42 આ કેસ case-sensitivity. થી રોકવા માં ઉપયોગ થાય છે.
03:45 week day મેઈન પ્રોગ્રામથી પેરામીટર ની જેમ પાસ થયેલ જે લોવર વેરીએબલ dollar week underscore day પર અસાઇન થાય છે.
03:55 આપેલ પ્રિન્ટ સ્ટેટમેન્ટ નિર્દિષ્ટ week day. થી સબંધિત ડેટાને પ્રિન્ટ કરશે.
04:01 આપણે $weather underscore report માં એક વેલ્યુ ને dereference કરવા માટે એરો ઓપરેટર ઉપયોગ કરી રહ્યા છીએ.
04:09 જયારે રેફરેન્સ ના સાથે કાર્ય થયી રહ્યો છે તો આપણે data type ને સમઝાવાવાનું છે જે આપણે dereferencing કરી રહ્યા છીએ.
04:15 જો આ એક હેશ છે તો આપણને છગડીયો કૌંસ માં key પાસ કરવાની જુરીયાત છે.
04:20 જો આ એક એરે છે તો આપણેને index values ના સાથે ચોરસ કૌંસ ઉપયોગ કરવાની જુરીયાત છે.
04:26 પર્લનું રીટર્ન ફંકશન એક વેલ્યુ રીટર્ન કરે છે.
04:29 આ મેઈન પ્રોગ્રામમાં 'function સ્ટેટ્સ ને તપાસવા માટે ઉપયોગ કરી શકાય છે.
04:36 આગલું ફંકશન write underscore daily underscore report. છે.
04:40 આ ફંકશન ફાઈલ પર રીપોર્ટ આઉટ પુટ પ્રિન્ટ કરશે.
04:45 ગ્રેટર ધેન (>) સિમ્બોલ ના સાથે ઓપન ફંકશન WRITE મોડ વ્યાખ્યાયિત કરે છે.
04:50 weekday ના નામ અને dot txt એક્સટેન્શન ના સાથે ફાઈલ નું નામ બને છે.
04:56 પ્રિન્ટ સ્ટેટમેન્ટ ફાઈલ પર નિર્દિષ્ટ weekday થી સમ્બન્ધિત ડેટા પ્રિન્ટ કરશે.
05:02 આ વીકલી રીપોર્ટ ને પ્રિન્ટ કરે છે.
05:05 મેં hash reference ના દરેક weekday ને લૂપ કરવા માટે એક foreach loop ડીકલેર કર્યું છે.
05:11 મેં hash reference ને દેખાડવા માટે છગડીયો કૌંસ અને dereference ના માટે એરો ઓપરેટર ઉપયોગ કર્યો છે.
05:18 હું હેશ ની કી ને લૂપ ક્ર્વ્ક માટે “keys” in-built function ઉપયોગ કરી રહી છું.
05:23 display underscore daily underscore report function હેશ દરેક એલિમેન્ટ ને પ્રિન્ટ કરશે.
05:30 હવે પર્લ પ્રોગ્રામ weather underscore report dot pl જોઈએ જ્યાં આપણે આ મોડ્યુલ ફાઈલ Weather dot pm નો ઉપયોગ કરીશું.
05:40 અહી use strict અને use warnings કમ્પાઈલ ફ્લેગ્સ છે જે સામાન્ય પ્રોગ્રામિંગ ની ભૂલોથી બચવા માટે મદદ કરે છે.
05:48 use Weather સેમીકોલન.અહી Weather એક મોડ્યુલ નામ છે જે મેં આ પ્રોગ્રામમાં ઉપયોગ કર્યો છે.
05:56 આપણે પહેલા જ જોયું કે આ પ્રોગ્રામ ના માટે આવશ્ક ફંકશન આ મોડ્યુલ માં સંગ્રહ કર્યું છે.
06:03 અહી dot pm ફાઈલ એક્સટેન્શન આપવાની જરૂરત નથી.
06:08 આ પ્રોગ્રામમાં હું આપેલ વિકલ્પો ના આધાર પર વિવિધ રીપોર્ટસ પ્રિન્ટ કરીશ.
06:14 આપેલ ને પ્રિન્ટ કરવા માટે યુઝરને એક વિકલ્પ ઉમેરવું પડશે.
   વિશેષ વિકડે ની દૈનિક હવામાન રીપોર્ટ
   આઉટપુટ ફાઈલ માં  વિશેષ વિકડે ની દૈનિક હવામાન રીપોર્ટ
   સાપ્તાહિક હવામાન રીપોર્ટ 


06:27 જો વિકલ્પ '1' ટાઈપ થાય છે તો યુઝર થી અઠવાડિયાનો એક દિવસ ઉમેરવા માટે કહેશે.
06:32 diamond ઓપરેટર STDIN, થી વાંચશે જે એક કીબોર્ડ છે.
06:38 ઉદાહરણના માટે જો યુઝર 'monday' ઉમેરે છે તો આ વેરીએબલ dollar dayoption, પર અસાઇન થાય છે જે એક લોકલ વેરીએબલ છે.
06:47 Next, we can see that we are calling two functions-
  • display_header() and
  • display_daily_report().
06:56 We have exported all functions in Weather dot pm with “use Weather” statement in this file.
07:03 So, no need to refer the functions within a package using the colon colon (::)package qualifier
07:10 Now let's see the next option.
07:13 If option '2' is typed, it will prompt the user to enter the day of a week.
07:19 $dayoption is passed as the input parameter to the function write underscore daily underscore report.
07:27 return value from the function is stored in the variable dollar result.
07:33 Print statement asks the user to check the text file for the output.
07:38 The filename is created with the day of the week dot txt as output file.
07:46 If option '3' is typed, it prints the weather report for the whole week.
07:51 display underscore weekly underscore report is the function name of the weekly report.
07:57 This print statement draws a horizontal line for the specified number of times.
08:02 This is just to give a good look to the report.
08:06 Lastly, if the option is 4, it will quit the program.
08:11 If any option other than the ones specified is given, the print statement says “Incorrect option”.
08:19 Here, the exit value of '0' indicates the program ran successfully.
08:25 The exit value other than '0' means an error of some kind has occurred.
08:31 Now, let us execute the program.
08:34 Switch to the terminal and type perl weather underscore report dot pl and press Enter.
08:41 We can see four options on the screen.
08:45 Type '1 'and press Enter.
08:48 We are prompted to enter a day of the week. I'll type "monday" and press Enter.
08:56 This is the header output generated from the function display underscore header().
09:02 Now, we can see the weather report of Monday.
09:06 Now I'll again execute the program once again to demonstrate the other options.
09:13 Type 2 and press Enter.
09:17 At the prompt, we have to type any week day. I will type "wednesday" and press Enter.
09:25 We can see a message: Please check the file wednesday dot txt for report output .
09:32 The output has been written to this text file. Let us open the file and check the contents.
09:38 Type: gedit wednesday dot txt and press Enter.
09:44 The output file has been created with the entered week day name with 'txt' extension.
09:51 Now, let us check the next option.
09:54 Switch to the terminal and type: perl weather underscore report dot pl and press Enter.
10:00 Type '3 'and press Enter.
10:04 This time, we can see the weekly weather report.
10:08 The hash keys and hash values are stored in a random order.
10:13 So, the displayed output is not related to the order in which they were added.
10:19 With this, we come to the end of this tutorial. Let us summarize.
10:24 In this tutorial, we have seen a sample Perl program by covering main topics of our previous tutorials.
10:32 As an assignment, write a similar Perl program employee underscore report.pl for displaying employee salary, designation, department, leave_balance details.
10:45 Pass Employee ID or Employee name as input.
10:50 Write the required functions in the module Employee dot pm file.
10:56 The video at the following link summarize the spoken tutorial. Please download and watch it.
11:03 We conduct workshops and give certificates for those who pass our online tests.

For more details, please write to us.

11:12 Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.

More information on this mission is available at this link.

11:25 This is Nirmala Venkat from IIT Bombay, signing off. Thanks for watching.

Contributors and Content Editors

Jyotisolanki, PoojaMoolya