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

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 180: Line 180:
 
|-
 
|-
 
|04:29
 
|04:29
|This can be used to check the status of the '''function''' in the '''main''' program.
+
| આ મેઈન પ્રોગ્રામમાં '''function'' સ્ટેટ્સ ને તપાસવા માટે ઉપયોગ કરી શકાય છે.
  
 
|-
 
|-
 
|04:36
 
|04:36
|The next '''function''' is''' write underscore daily underscore report.'''
+
| આગલું ફંકશન ''' write underscore daily underscore report.''' છે.
  
 
|-
 
|-
 
|04:40
 
|04:40
  
|This '''function''' will print the '''report output''' to a file.
+
| આ ફંકશન ફાઈલ પર રીપોર્ટ આઉટ પુટ પ્રિન્ટ કરશે.
  
 
|-
 
|-
 
|04:45
 
|04:45
|The''' open''' function with the greater than (>) symbol defines the''' WRITE''' mode.
+
| ગ્રેટર ધેન  (>) સિમ્બોલ ના સાથે ઓપન ફંકશન ''' WRITE''' મોડ વ્યાખ્યાયિત કરે છે.
  
 
|-
 
|-
 
|04:50
 
|04:50
|Filename is created with the weekday name and '''dot txt '''extension.
+
| ''' weekday ''' ના નામ અને '''dot txt ''' એક્સટેન્શન ના સાથે ફાઈલ નું નામ બને છે.
  
 
|-
 
|-
 
|04:56
 
|04:56
|The '''print statements''' will print the corresponding data of a specified week day to a file.
+
|   પ્રિન્ટ સ્ટેટમેન્ટ ફાઈલ પર નિર્દિષ્ટ ''' weekday ''' થી સમ્બન્ધિત ડેટા પ્રિન્ટ કરશે.
  
 
|-
 
|-
 
|05:02
 
|05:02
|This prints the weekly report.
+
| આ વીકલી રીપોર્ટ ને પ્રિન્ટ કરે છે.
  
 
|-
 
|-
 
|05:05
 
|05:05
|I have declared a '''foreach loop''' to loop through each weekday of the''' hash reference'''.
+
| મેં ''' hash reference''' ના દરેક  ''' weekday ''' ને લૂપ કરવા માટે એક '''foreach loop''' ડીકલેર કર્યું છે.
  
 
|-
 
|-
 
|05:11
 
|05:11
|I have used curly brackets to represent the''' hash reference'''  and the '''arrow '''operator to''' dereference'''.
+
| મેં ''' hash reference'''  ને દેખાડવા માટે છગડીયો  કૌંસ અને ''' dereference''' ના માટે એરો ઓપરેટર ઉપયોગ કર્યો છે.
  
 
|-
 
|-
 
|05:18
 
|05:18
| I am using the''' “keys” in-built function '''to loop through the '''keys '''of the '''hash'''.
+
| હું હેશ ની કી ને લૂપ ક્ર્વ્ક માટે ''' “keys” in-built function ''' ઉપયોગ કરી રહી છું.
  
 
|-
 
|-
 
|05:23
 
|05:23
| '''display underscore daily underscore report function '''will print each element of the '''hash'''.
+
| '''display underscore daily underscore report function ''' હેશ દરેક એલિમેન્ટ ને પ્રિન્ટ કરશે.
  
 
|-
 
|-

Revision as of 11:51, 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 Now, let us see - a Perl program weather underscore report dot pl where we will make use of this module file Weather dot pm.
05:40 Here, use strict and use warnings are compiler flags that help to avoid common programming mistakes.
05:48 use Weather semicolon. Here, Weather is a module name which I have used in this program.
05:56 We have already seen that the functions required for this program have been stored in this module.
06:03 It is not required to give the dot pm file extension here.
06:08 In this program, I'll print different reports depending upon the given options.
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 If option '1' is typed, it will ask the user to enter the day of a week.
06:32 The diamond operator will read from STDIN, that is, from the keyboard.
06:38 For example, if the user enters 'monday', then it is assigned to a variable dollar dayoption, which is a local variable.
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