Difference between revisions of "PERL/C2/Comments-in-Perl/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 4: Line 4:
 
|-
 
|-
 
|00.00  
 
|00.00  
|  Welcome to the spoken tutorial on Comments in '''Perl'''.  
+
| Welcome to the spoken tutorial on Comments in '''Perl'''.  
  
 
|-
 
|-
 
| 00.05
 
| 00.05
|  In this tutorial, we will learn about
+
| In this tutorial, we will learn about
  
 
|-
 
|-
Line 42: Line 42:
 
|-
 
|-
 
| 00.43
 
| 00.43
|Commenting a piece of code in '''Perl''' can be done in two ways: a. Single Line b. Multi Line
+
|Commenting a piece of code in '''Perl''' can be done in two ways:  
 
+
 
+
  
 
|-
 
|-
|00.50
+
| 00.47
| ''Single Line'''
+
|'''Single Line'''  
  
 
|-
 
|-
|00.51
+
| 00.48
|This type of comment is used  
+
| ''' Multi Line'''
 +
|-
 +
|00.49
 +
|This type of comment is used when user wants to comment a single line of code or
 +
 
  
 
|-
 
|-
|00.53
+
|00.55
| when user wants to comment a single line of code or
+
|-
+
|00.57
+
 
| to add one liner text to explain the functionality of a piece of code
 
| to add one liner text to explain the functionality of a piece of code
  
 
|-
 
|-
|01.02
+
|01.01
 
|This type of comment starts with the symbol ''' # (hash) '''.
 
|This type of comment starts with the symbol ''' # (hash) '''.
  
 
|-
 
|-
| 01.07
+
| 01.05
 
|Here is a demo. Let us open a new file in the Text Editor.
 
|Here is a demo. Let us open a new file in the Text Editor.
  
 
|-
 
|-
 
| 01.11
 
| 01.11
| Open the '''Terminal''' and type - '''gedit comments dot pl &'''
+
| Open the '''Terminal''' and type - '''gedit comments dot pl space &'''
  
 
|-
 
|-
| 01.20
+
| 01.19
 
|Once again, reminding you that the '''ampersand''' is used to free the '''command prompt''' in the '''terminal'''. And press enter
 
|Once again, reminding you that the '''ampersand''' is used to free the '''command prompt''' in the '''terminal'''. And press enter
  
 
|-
 
|-
|01.30
+
|01.27
 
|Now type the following commands.
 
|Now type the following commands.
  
 
|-
 
|-
|01.32
+
|01.29
|'''hash Declaring count variable''' '''press enter'''
+
|'''hash Declaring count variable''' 'press '''Enter'''
  
 
|-
 
|-
|01.40
+
|01.37
|'''dollar count space equal to space 1 semicolon'''  '''press enter'''
+
|'''dollar count space equal to space 1 semicolon''' '''press enter'''
  
 
|-
 
|-
|01.48
+
|01.45
 
|'''print space double quotes Count is dollar count slash n double quote complete semicolon space hash prints Count is 1'''
 
|'''print space double quotes Count is dollar count slash n double quote complete semicolon space hash prints Count is 1'''
  
 
|-
 
|-
|02.06
+
|02.03
| Now Save this file by pressing ctlr s and execute the '''Perl''' script.
+
| Now Save this file by pressing ctlr S and execute the '''Perl''' script.
  
 
|-
 
|-
| 02.12
+
| 02.08
 
| Switch to the '''Terminal''', and type '''perl hyphen c comments dot pl''' and press '''Enter.'''
 
| Switch to the '''Terminal''', and type '''perl hyphen c comments dot pl''' and press '''Enter.'''
  
 
|-
 
|-
|02.23
+
|02.18
 
|This tells us that there is no syntax error
 
|This tells us that there is no syntax error
  
 
|-
 
|-
| 02.26
+
| 02.21
 
|Now type '''perl comments dot pl''' and press '''Enter.'''
 
|Now type '''perl comments dot pl''' and press '''Enter.'''
  
 
|-
 
|-
|02.33
+
|02.28
|   It will show the following output - '''Count is 1'''
+
|   It will show the following output - '''Count is 1'''
  
 
|-
 
|-
| 02.39
+
| 02.33
|Let us switch back to '''gedit'''. in '''gedit''', go to the first line and press enter.
+
|Let us switch back to '''gedit'''.  
  
 
|-
 
|-
|02.48
+
| 02.36
 +
|In '''gedit''', go to the first line and press enter.
 +
 
 +
|-
 +
|02.40
 
|Go back to the first line and type the following command.
 
|Go back to the first line and type the following command.
  
 
|-
 
|-
| 02.51
+
| 02.44
 
|'''Hash exclamation mark slash usr slash bin slash perl'''
 
|'''Hash exclamation mark slash usr slash bin slash perl'''
  
  
 
|-
 
|-
| 03.02
+
| 02.52
 
|This line in '''Perl''' is called as a '''shebang''' '''line''' and is the first line in a '''Perl '''program.
 
|This line in '''Perl''' is called as a '''shebang''' '''line''' and is the first line in a '''Perl '''program.
  
 
|-
 
|-
|03.09
+
|02.59
 
|It tells where to find the '''Perl Interpreter'''.
 
|It tells where to find the '''Perl Interpreter'''.
  
 
|-
 
|-
|03.12
+
|03.03
|'''Note:''' Though this line starts with hash''' '''symbol, it will not be considered as a single line comment by '''Perl'''.
+
|'''Note:''' Though this line starts with hash symbol, it will not be considered as a single line comment by '''Perl'''.
  
 
|-
 
|-
|03.21
+
|03.11
 
|Now let us look at multiline comments
 
|Now let us look at multiline comments
  
 
|-
 
|-
| 03.23
+
| 03.13
 
|'''Multi Line''' This type of comment is used  
 
|'''Multi Line''' This type of comment is used  
  
 
|-
 
|-
|03.27
+
|03.17
 
|when user wants to comment a piece of code or  to add description/usage of piece of code
 
|when user wants to comment a piece of code or  to add description/usage of piece of code
  
 
|-
 
|-
|03.35
+
|03.25
|This type of comment starts with the symbol '''equal to''' '''''head''''' and ends with '''equal to ''cut'''''
+
|This type of comment starts with the symbol '''equal to head''' and ends with '''equal to cut'''
  
 
|-
 
|-
| 03.43
+
| 03.33
|Lets switch back to '''gedit''' and type the following -
+
|Lets switch back to '''gedit''' and type the following in the '''comments dot pl '''file
  
 
|-
 
|-
|03.46
+
|03.39
|in the '''comments dot pl '''file at the end of file type
+
|at the end of file type '''equal to head''', press '''Enter'''
  
 
|-
 
|-
|03.57
+
|03.45
|'''equal to head''' '''press enter'''
+
 
+
|-
+
|04.03
+
 
|'''print space double quote count variable is  used for counting purpose double quote complete''' '''press enter'''
 
|'''print space double quote count variable is  used for counting purpose double quote complete''' '''press enter'''
  
 
|-
 
|-
|04.24
+
|03.59
 
|'''equal to cut'''
 
|'''equal to cut'''
  
 
|-
 
|-
| 04.26
+
| 04.01
 
| Save the file, close it and execute the '''Perl''' script.
 
| Save the file, close it and execute the '''Perl''' script.
  
 
|-
 
|-
| 04.30
+
| 04.05
 
| On the '''Terminal''', type '''perl hyphen c comments dot pl''' and press '''Enter'''.
 
| On the '''Terminal''', type '''perl hyphen c comments dot pl''' and press '''Enter'''.
  
 
|-
 
|-
|04.40
+
|04.13
 
|No syntax error
 
|No syntax error
  
 
|-
 
|-
| 04.41
+
| 04.15
 
| so let us execute it '''perl comments dot pl'''  
 
| so let us execute it '''perl comments dot pl'''  
  
 
|-
 
|-
| 04.48
+
| 04.21
|  It will show the same output as before. '''Count is 1'''
+
| It will show the same output as before. '''Count is 1'''
  
 
|-
 
|-
|04.55
+
|04.27
|  It does not print the sentence '''“count variable is be used for counting purpose”'''
+
| It does not print the sentence '''“count variable is be used for counting purpose”'''
  
 
|-
 
|-
|05.02
+
|04.32
 
| This is because we commented the portion using '''equal to head''' and '''equal to cut'''
 
| This is because we commented the portion using '''equal to head''' and '''equal to cut'''
  
 
|-
 
|-
|05.13
+
|04.40
|  You can either use  =head =cut or '''=begin =end.'''
+
| You can either use  '''=head =cut''' or '''=begin =end.'''
  
 
|-
 
|-
|05.21
+
|04.48
 
|These are not the special keywords used by '''Perl'''.
 
|These are not the special keywords used by '''Perl'''.
  
 
|-
 
|-
| 05.24
+
| 04.52
|  '''Please note''' there should not be any leading or trailing space(s) before '''= to''' sign and after the '''head''', '''cut''', '''begin''' or '''end''' word.
+
| '''Please note''' there should not be any leading or trailing space(s) before '''= to''' sign and after the '''head''', '''cut''', '''begin''' or '''end''' word.
  
 
|-
 
|-
|05.35
+
|05.02
 
|  Open the '''Terminal''' once again.
 
|  Open the '''Terminal''' once again.
  
 
|-
 
|-
| 05.39 
+
| 05.05
|And Type - ''' perl gedit commentsExample dot pl &''' and press '''Enter'''.
+
|And Type - ''' gedit commentsExample dot pl space &''' and press '''Enter'''.
  
 
|-
 
|-
|  05.56
+
| 05.15
|  Type the following commands as shown on the screen.
+
| Type the following commands as shown on the screen.
  
 
|-
 
|-
|06.02
+
|05.19
 
|Here I am declaring two variables '''firstNum '''and '''secondNum '''and I am assigning some values to them.
 
|Here I am declaring two variables '''firstNum '''and '''secondNum '''and I am assigning some values to them.
  
 
|-
 
|-
|06.09
+
|05.28
 
|Then I have commented this portion here.
 
|Then I have commented this portion here.
  
 
|-
 
|-
|06.15
+
|05.32
 
|Now I added these two numbers and assign the value to a third variable named addition.
 
|Now I added these two numbers and assign the value to a third variable named addition.
  
 
|-
 
|-
|06.24
+
|05.39
 
|Next I want to print the value using print command.
 
|Next I want to print the value using print command.
 +
 
|-
 
|-
|06.31
+
|05.44
 
| Save the file and execute the '''Perl''' script on the '''Terminal'''.
 
| Save the file and execute the '''Perl''' script on the '''Terminal'''.
  
 
|-
 
|-
|06.37
+
|05.49
|On terminal type '''perl hyphen c commentsExample dot pl'''
+
|On terminal type '''perl hyphen c commentsExample dot pl''', press '''Enter.'''
  
 
|-
 
|-
|06.43
+
|05.57
|press enter.There is no syntax error
+
|There is no syntax error
  
 
|-
 
|-
|06.47
+
|05.59
|so execute the script by typing
+
|So execute the script by typing
  
  
 
|-
 
|-
|06.49
+
|06.01
 
|'''perl commentsExample dot pl''' press enter
 
|'''perl commentsExample dot pl''' press enter
  
 
|-
 
|-
|  06.56
+
| 06.07
|  It will show the following output. '''Addition is 30'''
+
| It will show the following output. '''Addition is 30'''
  
 
|-
 
|-
| 07.05
+
| 06.12
 
| This brings us to the end of this tutorial.
 
| This brings us to the end of this tutorial.
  
 
|-
 
|-
|07.08
+
|06.16
 
|Here we learnt, To Add Comments in '''Perl'''
 
|Here we learnt, To Add Comments in '''Perl'''
  
Line 277: Line 277:
  
 
|-
 
|-
|07.12
+
|06.19
 
|Write a perl script to find square of a number.  
 
|Write a perl script to find square of a number.  
 
|-
 
|-
|07.16
+
|06.23
|Explain the functionality of the code written using:  Single Line Comment & Mutli Line Comment.  
+
|Explain the functionality of the code written using: Single Line Comment & Mutli Line Comment.  
  
  
  
 
|-
 
|-
| 07.23
+
| 06.30
 
| Watch the video available at the following link  
 
| Watch the video available at the following link  
  
 
|-
 
|-
|07.27
+
|06.34
 
|It summarises the Spoken Tutorial project  
 
|It summarises the Spoken Tutorial project  
  
 
|-
 
|-
|07.31
+
|06.37
|If you do not have good bandwidth, you can  download and watch it  
+
|If you do not have good bandwidth, you can  download and watch it  
  
 
|-
 
|-
|  07.35
+
| 06.42
|  The Spoken Tutorial Project Team  
+
| The Spoken Tutorial Project Team  
  
 
|-
 
|-
|07.37
+
|06.44
 
|Conducts workshops using spoken tutorials  
 
|Conducts workshops using spoken tutorials  
  
 
|-
 
|-
|07.41
+
|06.48
 
|Gives certificates to those who pass an online test  
 
|Gives certificates to those who pass an online test  
  
 
|-
 
|-
|07.44
+
|06.51
|For more details, please write to  contact at spoken hyphen tutorial dot org  
+
|For more details, please write to  contact at spoken hyphen tutorial dot org  
  
 
|-
 
|-
| 07.51
+
| 06.58
| Spoken Tutorial Project is a part of the Talk to Teacher project  
+
| Spoken Tutorial Project is a part of the Talk to Teacher project  
  
 
|-
 
|-
|07.56
+
|07.03
|It is supported by the National Mission on  Education through ICT, MHRD, Government  of India  
+
|It is supported by the National Mission on  Education through ICT, MHRD, Government  of India  
  
 
|-
 
|-
|08.04
+
|07.11
|More information on this Mission is available  at the following link.
+
|More information on this Mission is available  at the following link.
  
 
|-
 
|-
| 08.09
+
| 07.15
|  Hope you enjoyed this '''Perl''' tutorial.  This is Amol Brahmankar signing off.
+
| Hope you enjoyed this '''Perl''' tutorial. This is Amol Brahmankar signing off.
  
 
Thanks for joining.
 
Thanks for joining.
  
 
|}
 
|}

Revision as of 12:14, 12 May 2014

Visual Cue
Narration
00.00 Welcome to the spoken tutorial on Comments in Perl.
00.05 In this tutorial, we will learn about
00.08 Comments in Perl
00.10 I am using Ubuntu Linux12.04 operating system and Perl 5.14.2
00.18 that is, Perl revision 5 version 14 and subversion 2


00.23 I will also be using the gedit Text Editor.
00.27 You can use any text editor of your choice.


00.31 You should have Basic knowledge of Compiling, Executing and Variables in Perl
00.37 If not, please go through the relevant spoken tutorials on the spoken tutorial website
00.43 Commenting a piece of code in Perl can be done in two ways:
00.47 Single Line
00.48 Multi Line
00.49 This type of comment is used when user wants to comment a single line of code or


00.55 to add one liner text to explain the functionality of a piece of code
01.01 This type of comment starts with the symbol # (hash) .
01.05 Here is a demo. Let us open a new file in the Text Editor.
01.11 Open the Terminal and type - gedit comments dot pl space &
01.19 Once again, reminding you that the ampersand is used to free the command prompt in the terminal. And press enter
01.27 Now type the following commands.
01.29 hash Declaring count variable 'press Enter
01.37 dollar count space equal to space 1 semicolon press enter
01.45 print space double quotes Count is dollar count slash n double quote complete semicolon space hash prints Count is 1
02.03 Now Save this file by pressing ctlr S and execute the Perl script.
02.08 Switch to the Terminal, and type perl hyphen c comments dot pl and press Enter.
02.18 This tells us that there is no syntax error
02.21 Now type perl comments dot pl and press Enter.
02.28 It will show the following output - Count is 1
02.33 Let us switch back to gedit.
02.36 In gedit, go to the first line and press enter.
02.40 Go back to the first line and type the following command.
02.44 Hash exclamation mark slash usr slash bin slash perl


02.52 This line in Perl is called as a shebang line and is the first line in a Perl program.
02.59 It tells where to find the Perl Interpreter.
03.03 Note: Though this line starts with hash symbol, it will not be considered as a single line comment by Perl.
03.11 Now let us look at multiline comments
03.13 Multi Line This type of comment is used
03.17 when user wants to comment a piece of code or to add description/usage of piece of code
03.25 This type of comment starts with the symbol equal to head and ends with equal to cut
03.33 Lets switch back to gedit and type the following in the comments dot pl file
03.39 at the end of file type equal to head, press Enter
03.45 print space double quote count variable is used for counting purpose double quote complete press enter
03.59 equal to cut
04.01 Save the file, close it and execute the Perl script.
04.05 On the Terminal, type perl hyphen c comments dot pl and press Enter.
04.13 No syntax error
04.15 so let us execute it perl comments dot pl
04.21 It will show the same output as before. Count is 1
04.27 It does not print the sentence “count variable is be used for counting purpose”
04.32 This is because we commented the portion using equal to head and equal to cut
04.40 You can either use =head =cut or =begin =end.
04.48 These are not the special keywords used by Perl.
04.52 Please note there should not be any leading or trailing space(s) before = to sign and after the head, cut, begin or end word.
05.02 Open the Terminal once again.
05.05 And Type - gedit commentsExample dot pl space & and press Enter.
05.15 Type the following commands as shown on the screen.
05.19 Here I am declaring two variables firstNum and secondNum and I am assigning some values to them.
05.28 Then I have commented this portion here.
05.32 Now I added these two numbers and assign the value to a third variable named addition.
05.39 Next I want to print the value using print command.
05.44 Save the file and execute the Perl script on the Terminal.
05.49 On terminal type perl hyphen c commentsExample dot pl, press Enter.
05.57 There is no syntax error
05.59 So execute the script by typing


06.01 perl commentsExample dot pl press enter
06.07 It will show the following output. Addition is 30
06.12 This brings us to the end of this tutorial.
06.16 Here we learnt, To Add Comments in Perl


06.19 Write a perl script to find square of a number.
06.23 Explain the functionality of the code written using: Single Line Comment & Mutli Line Comment.


06.30 Watch the video available at the following link
06.34 It summarises the Spoken Tutorial project
06.37 If you do not have good bandwidth, you can download and watch it
06.42 The Spoken Tutorial Project Team
06.44 Conducts workshops using spoken tutorials
06.48 Gives certificates to those who pass an online test
06.51 For more details, please write to contact at spoken hyphen tutorial dot org
06.58 Spoken Tutorial Project is a part of the Talk to a Teacher project
07.03 It is supported by the National Mission on Education through ICT, MHRD, Government of India
07.11 More information on this Mission is available at the following link.
07.15 Hope you enjoyed this Perl tutorial. This is Amol Brahmankar signing off.

Thanks for joining.

Contributors and Content Editors

Gaurav, Madhurig, PoojaMoolya, Sandhya.np14, Sneha