https://script.spoken-tutorial.org/index.php?title=PERL/C2/Comments-in-Perl/English&feed=atom&action=history
PERL/C2/Comments-in-Perl/English - Revision history
2024-03-28T11:32:55Z
Revision history for this page on the wiki
MediaWiki 1.23.17
https://script.spoken-tutorial.org/index.php?title=PERL/C2/Comments-in-Perl/English&diff=43547&oldid=prev
Nancyvarkey at 04:13, 27 June 2018
2018-06-27T04:13:18Z
<p></p>
<a href="https://script.spoken-tutorial.org/index.php?title=PERL/C2/Comments-in-Perl/English&diff=43547&oldid=3650">Show changes</a>
Nancyvarkey
https://script.spoken-tutorial.org/index.php?title=PERL/C2/Comments-in-Perl/English&diff=3650&oldid=prev
Sneha at 06:01, 15 April 2013
2013-04-15T06:01:13Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 06:01, 15 April 2013</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 151:</td>
<td colspan="2" class="diff-lineno">Line 151:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>in '''gedit''', go to the first line and press enter.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>in '''gedit''', go to the first line and press enter.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Go back to the first line and type the following <del class="diffchange diffchange-inline">code</del>.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Go back to the first line and type the following <ins class="diffchange diffchange-inline">command</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''Hash exclamation mark slash usr slash bin slash perl'''</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''Hash exclamation mark slash usr slash bin slash perl'''</div></td></tr>
</table>
Sneha
https://script.spoken-tutorial.org/index.php?title=PERL/C2/Comments-in-Perl/English&diff=3649&oldid=prev
Sneha at 05:57, 15 April 2013
2013-04-15T05:57:41Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 05:57, 15 April 2013</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 237:</td>
<td colspan="2" class="diff-lineno">Line 237:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''perl comments dot pl'''</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''perl comments dot pl'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">and press '''Enter'''.</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|-</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|-</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 251:</td>
<td colspan="2" class="diff-lineno">Line 250:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''“count variable will be used for counting purpose”'''</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''“count variable will be used for counting purpose”'''</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| It does not print the sentence '''“count variable <del class="diffchange diffchange-inline">will </del>be used for counting purpose”'''</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| It does not print the sentence '''“count variable <ins class="diffchange diffchange-inline">is </ins>be used for counting purpose”'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|-</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|-</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 274:</td>
<td colspan="2" class="diff-lineno">Line 273:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Type  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Type  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>'''gedit comments.pl &'''</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>''' <ins class="diffchange diffchange-inline">perl </ins>gedit comments.pl &'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>and press '''Enter'''.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>and press '''Enter'''.</div></td></tr>
</table>
Sneha
https://script.spoken-tutorial.org/index.php?title=PERL/C2/Comments-in-Perl/English&diff=3408&oldid=prev
AmolBrahmankar: Created page with ''''Title of script''': Comments in Perl '''Author: Amol''' '''Keywords: Comments in Perl, Video Tutorials, Scalars in Perl''' {| style="border-spacing:0;" | style="border:0.…'
2013-03-21T06:12:08Z
<p>Created page with ''''Title of script''': Comments in Perl '''Author: Amol''' '''Keywords: Comments in Perl, Video Tutorials, Scalars in Perl''' {| style="border-spacing:0;" | style="border:0.…'</p>
<p><b>New page</b></p><div>'''Title of script''': Comments in Perl<br />
<br />
'''Author: Amol'''<br />
<br />
'''Keywords: Comments in Perl, Video Tutorials, Scalars in Perl'''<br />
<br />
<br />
<br />
{| style="border-spacing:0;"<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| <center>'''Visual Cue'''</center><br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| <center>'''Narration'''</center><br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Slide<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Welcome to the spoken tutorial on Comments in '''Perl'''. <br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Slide:Learning Objectives<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| In this tutorial, we will learn about<br />
<br />
Comments in '''Perl'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Slide:System Requirements<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| I am using '''Ubuntu Linux12.04''' operating system and <br />
<br />
'''Perl''' '''5.14.2 '''<br />
<br />
that is, '''Perl''' revision 5 version 14 and subversion 2<br />
<br />
<br />
I will also be using the '''gedit Text Editor'''. <br />
<br />
You can use any text editor of your choice.<br />
<br />
<br />
You should have Basic knowledge of Compiling, Executing and Variables in Perl <br />
<br />
If not, please go through the relevant spoken tutorials on the spoken tutorial website <br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Slide<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Commenting a piece of code in '''Perl''' can be done in two ways:<br />
<br />
a. Single Line<br />
<br />
b. Multi Line<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Slide<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| '''Single Line'''<br />
<br />
This type of comment is used <br />
<br />
* when user wants to comment a single line of code or <br />
* to add one liner text to explain the functionality of a piece of code<br />
<br />
This type of comment starts with the symbol '''<nowiki># (hash)</nowiki>'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| <br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Here is a demo.<br />
<br />
Let us open a new file in the Text Editor.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Switch to the '''Terminal''' and type <br />
<br />
'''gedit singlemulti.pl &'''<br />
<br />
and press '''Enter'''.<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Open the '''Terminal''' and type -<br />
<br />
'''gedit comments dot pl &'''<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Highlight '''&'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Once again, reminding you that the '''ampersand''' is used to free the '''command prompt''' in the '''terminal'''. And press enter<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Type<br />
<br />
'''<nowiki># Declaring count variable</nowiki>'''<br />
<br />
'''$count = 1; '''<br />
<br />
'''print “Count is $count \n”; # prints Count is 1'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Now type the following commands.<br />
<br />
'''hash Declaring count variable'''<br />
<br />
'''press enter'''<br />
<br />
'''dollar count space equal to space 1 semicolon'''<br />
<br />
'''press enter'''<br />
<br />
'''print space double quotes Count is dollar count slash n double quote complete semicolon space hash prints Count is 1'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Save the file.<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Now Save this file by pressing ctlr s file and execute the '''Perl''' script.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Switch to the Terminal and type<br />
<br />
'''perl -c singlemulti.pl'''<br />
<br />
and press '''Enter'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Switch to the '''Terminal''', and type<br />
<br />
'''perl hyphen c comments dot pl'''<br />
<br />
and press '''Enter.'''<br />
<br />
This tells us that there is no syntax error<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Then type<br />
<br />
'''perl singlemulti.pl'''<br />
<br />
and press '''Enter'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Now type<br />
<br />
'''perl comments dot pl'''<br />
<br />
and press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Point to the output<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| It will show the following output -<br />
<br />
'''Count is 1'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Go to '''gedit''' and type <br />
<br />
'''<nowiki>#!/usr/bin/perl</nowiki>'''<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Let us switch back to '''gedit'''.<br />
<br />
in '''gedit''', go to the first line and press enter.<br />
<br />
Go back to the first line and type the following code.<br />
<br />
'''Hash exclamation mark slash usr slash bin slash perl'''<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Slide<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| This line in '''Perl''' is called as a '''shebang''' '''line''' and is the first line in a '''Perl '''program.<br />
<br />
It tells where to find the '''Perl Interpreter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Slide<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| '''Note:''' Though this line starts with hash''' '''symbol, it will not be considered as a single line comment by '''Perl'''.<br />
<br />
Now let us look at multiline comments<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Slide<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| '''Multi Line'''<br />
<br />
This type of comment is used <br />
<br />
* when user wants to comment a piece of code or <br />
* to add description/usage of piece of code<br />
<br />
This type of comment starts with the symbol '''equal to''' '''''head''''' and ends with '''equal to ''cut'''''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Type<br />
<br />
'''<nowiki>=head</nowiki>'''<br />
<br />
'''print “ count variable will be used for counting purpose”'''<br />
<br />
'''<nowiki>=cut</nowiki>'''<br />
<br />
above<br />
<br />
'''$count = 1; '''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Lets switch back to '''gedit''' and type the following -<br />
<br />
in the '''comments dot pl '''file<br />
<br />
at the end of file type<br />
<br />
'''equal to head'''<br />
<br />
'''press enter'''<br />
<br />
'''print space double quote count variable will be used for counting purpose double quote complete'''<br />
<br />
'''press enter'''<br />
<br />
'''equal to cut'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Save the file and close it.<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Save the file, close it and execute the '''Perl''' script.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Switch to the Terminal and type<br />
<br />
'''perl -c singlemulti.pl'''<br />
<br />
and press '''Enter'''.<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| On the '''Terminal''', type<br />
<br />
'''perl hyphen c comments dot pl'''<br />
<br />
and press '''Enter'''.<br />
<br />
No syntax error<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Then type<br />
<br />
'''perl singlemulti.pl'''<br />
<br />
and press '''Enter'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| so let us execute it<br />
<br />
'''perl comments dot pl'''<br />
<br />
and press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Point to the output<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| It will show the same output as before.<br />
<br />
'''Count is 1'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Switch back to gedit<br />
<br />
Point to the sentence<br />
<br />
'''“count variable will be used for counting purpose”'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| It does not print the sentence '''“count variable will be used for counting purpose”'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Point to '''<nowiki>=head</nowiki>''' and '''<nowiki>=cut </nowiki>'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| This is because we commented the portion using '''equal to head''' and '''equal to cut'''<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Slide<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| You can either use '''<nowiki>=head =cut</nowiki>''' or '''<nowiki>=begin =end.</nowiki>'''<br />
<br />
These are not the special keywords used by '''Perl'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| <br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| '''Please note''' there should not be any leading or trailing space(s) before '''<nowiki>= to</nowiki>''' sign and after the '''head''', '''cut''', '''begin''' or '''end''' word.<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Switch to the '''Terminal''' <br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Open the '''Terminal''' once again.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Type <br />
<br />
'''gedit comments.pl &'''<br />
<br />
and press '''Enter'''.<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| And Type -<br />
<br />
'''gedit commentsExample dot pl &'''<br />
<br />
and press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Type<br />
<br />
'''<nowiki># Here I am going to explain commenting in Perl</nowiki>'''<br />
<br />
'''<nowiki># Following is the scalar variable declaration</nowiki>'''<br />
<br />
'''$firstNum = 10;'''<br />
<br />
'''$secondNum = 20;'''<br />
<br />
<br />
'''<nowiki>=head</nowiki>'''<br />
<br />
'''following piece of code adds 2 numbers'''<br />
<br />
'''puts the result into a 3<sup>rd</sup> variable'''<br />
<br />
'''and prints this 3<sup>rd</sup> variable'''<br />
<br />
'''<nowiki>=cut</nowiki>'''<br />
<br />
'''$addition = $firstNum + $secondNum;'''<br />
<br />
'''print “Addition is $addition”;'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Type the following commands as shown on the screen.<br />
<br />
Here I am declaring two variables '''firstNum '''and '''secondNum '''and I am assigning some values to them.<br />
<br />
Then I have commented this portion here.<br />
<br />
Now I added these two numbers and assign the value to a third variable named addition.<br />
<br />
Next I want to print the value using print command.<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Save the file and switch to the '''Terminal'''.<br />
<br />
Type<br />
<br />
'''perl -c comments.pl'''<br />
<br />
'''perl comments.pl'''<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Save the file and execute the '''Perl''' script on the '''Terminal'''.<br />
<br />
<br />
On terminal type<br />
<br />
'''perl hyphen c commentsExample dot pl'''<br />
<br />
press enter<br />
<br />
There is no syntax error<br />
<br />
so execute the script by typing<br />
<br />
<br />
'''perl commentsExample dot pl'''<br />
<br />
press enter<br />
<br />
|-<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| Point to the output<br />
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0.106cm;"| It will show the following output.<br />
<br />
'''Addition is 30'''<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Summary<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| This brings us to the end of this tutorial.<br />
<br />
Here we learnt, <br />
<br />
To Add Comments in '''Perl'''<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Assignment<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| '''Assignment'''<br />
<br />
# Write a perl script to find square of a number. <br />
# Explain the functionality of the code written using: <br />
<br />
* Single Line Comment. <br />
* Mutli Line Comment. <br />
<br />
<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| About the Project<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Watch the video available at the following link <br />
<br />
It summarises the Spoken Tutorial project <br />
<br />
If you do not have good bandwidth, you can <br />
<br />
download and watch it <br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Spoken Tutorial Workshops <br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| The Spoken Tutorial Project Team <br />
<br />
Conducts workshops using spoken tutorials <br />
<br />
Gives certificates to those who pass an online <br />
<br />
test <br />
<br />
For more details, please write to <br />
<br />
contact at spoken hyphen tutorial dot org <br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Acknowledgment<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Spoken Tutorial Project is a part of the Talk to a <br />
<br />
Teacher project <br />
<br />
It is supported by the National Mission on <br />
<br />
Education through ICT, MHRD, Government <br />
<br />
of India <br />
<br />
More information on this Mission is available <br />
<br />
at the following link.<br />
<br />
|-<br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| <br />
| style="border:0.5pt solid #000000;padding:0.106cm;"| Hope you enjoyed this '''Perl''' tutorial. <br />
<br />
This is Amol Brahmankar signing off.<br />
<br />
Thanks for joining.<br />
<br />
|}</div>
AmolBrahmankar