In PERL Syntax
-
Upload
raradewrer -
Category
Documents
-
view
219 -
download
0
Transcript of In PERL Syntax
-
8/9/2019 In PERL Syntax
1/48
__END__ in PERL syntaxIt seems __END__ is a "synonym" of __DATA__ following code proves that
Perl Syntax (Toggle Plain Text)
1.while () {
2.print;
3.}
4.
5.__END__
6.hello
7.
8.__DATA__
9.first data line
10.2nd data line
while () { print; } __END__ hello __DATA__ first data line 2nd data line
Perl Syntax (Toggle Plain Text)
1.C:\>perl c:\d.pl
2.hello
3.
4.first data line
5.2nd data line
-
8/9/2019 In PERL Syntax
2/48
C:\>perl c:\d.pl hello first data line 2nd data line
the text "hello" is displayed as it was put in __DATA__ section.lordspaceReputation Points: 12
Solved Threads: 5Junior Poster in Traininglordspace is offline Offline68 postssince May 2006Permalink Mar 27th, 20070Re: __END__ in PERL syntaxClick to Expand / Collapse Quote originally posted by lordspace ...
It seems __END__ is a "synonym" of __DATA__
http://perldoc.perl.org/perldata.html
Quote ...
For compatibility with older scripts written before __DATA__ was introduced,
__END__ behaves like __DATA__ in the toplevel script (but not in files loaded withrequire or do) and leaves the remaining contents of the file accessible via main::DATA .
Last edited by KevinADC; Mar 27th, 2007 at 12:37 am.KevinADCReputation Points: 176Solved Threads: 67Practically a Posting Shark KevinADC is offline Offline898 postssince Mar 2006Permalink 16 Days Ago0Re: __END__ in PERL syntaxI guess its something to do with the POD (Plain Old Documentation)..
You can refer to http://perldoc.perl.org/perlpod.html
-
8/9/2019 In PERL Syntax
3/48
You can put the documentation at the end of the file. So wen u use man or help inoptions on command line this documentation could be fetched and displayed.abhijithtk Reputation Points: 10
Solved Threads: 0 Newbie Poster abhijithtk is offline Offline3 postssince Jun 2010Permalink 16 Days Ago1Re: __END__ in PERL syntaxClick to Expand / Collapse Quote originally posted by abhijithtk ...
I guess its something to do with the POD (Plain Old Documentation)..
You can refer to http://perldoc.perl.org/perlpod.html
You can put the documentation at the end of the file. So wen u use man or help inoptions on command line this documentation could be fetched and displayed.
Er, no. _END_ (and the moderner _DATA_) are markers for the script to ignore/not
parse what follows, but makes it available from the "built-in" file handle DATA. PODuses a different set of markers to allow documentation to be included in the script andignored as code. Some folks may *use* _END_ to hide their comments/PDD from thecode but that's not it's purpose.afbachReputation Points: 11Solved Threads: 0
Newbie Poster afbach is offline Offline7 postssince Mar 2006Permalink 16 Days Ago0Re: __END__ in PERL syntaxClick to Expand / Collapse Quote originally posted by afbach ...
Er, no. _END_ (and the moderner _DATA_) are markers for the script to ignore/not
-
8/9/2019 In PERL Syntax
4/48
parse what follows, but makes it available from the "built-in" file handle DATA. PODuses a different set of markers to allow documentation to be included in the script andignored as code. Some folks may *use* _END_ to hide their comments/PDD from thecode but that's not it's purpose.
Ok Question..
http://perldoc.perl.org/Pod/Usage.html
Have a look under "Recommended Usage" at the bottom of the page. I copied the scriptand tried to run it on my machine. For some reason it doesnt display anything if i givethe -man or -help options.
Any idea whY? is there something wrong with the script that needs to be fixed..abhijithtk Reputation Points: 10Solved Threads: 0
Newbie Poster abhijithtk is offline Offline3 postssince Jun 2010Permalink 16 Days Ago
0Re: __END__ in PERL syntaxClick to Expand / Collapse Quote originally posted by abhijithtk ...
Ok Question..
http://perldoc.perl.org/Pod/Usage.html
Have a look under "Recommended Usage" at the bottom of the page. I copied thescript and tried to run it on my machine. For some reason it doesnt display anything if igive the -man or -help options.
Any idea whY? is there something wrong with the script that needs to be fixed..
hmm, works here. "-help" actually gives me 2 versions and -man gives me a man styleoutput (I named it use.pl):Perl Syntax (Toggle Plain Text)
-
8/9/2019 In PERL Syntax
5/48
1.$ perl use.pl
2.use.pl: No files given.
3.
Usage:4.sample [options] [file ...]
5.
6.Options: -help brief help message -man full documentation
$ perl use.pl use.pl: No files given. Usage: sample[options] [file ...] Options: -help brief help message -man full documentationPerl Syntax (Toggle Plain Text)
1.$ perl use.pl -help
2.Usage:
3.sample [options] [file ...]
4.
5.Options: -help brief help message -man full documentation
6.
7.Options:
8.-help Print a brief help message and exits.
9.
10.-man Prints the manual page and exits.
$ perl use.pl -help Usage: sample [options] [file ...]Options: -help brief help message -man full documentation Options: -help Print a brief help message and exits. -man Prints the manual page and exits.What sort of machine are you running it on?
-
8/9/2019 In PERL Syntax
6/48
afbachReputation Points: 11Solved Threads: 0
Newbie Poster afbach is offline Offline
7 postssince Mar 2006
* Page 1* 2* Next
DaniWeb Message Cancel ChangesThe following errors occurred with your submissionOkayMessage:Posting Quick Reply - Please Wait Posting Quick Reply - Please WaitPrevious Thread in Perl Forum Timeline: perl qt
Next Thread in Perl Forum Timeline: Remove leading and trailing white space from astring
Tag Cloud for Perlactivestate ajax array arrays auth basic c++ catalyst cgi child comments compare datesdevelopment file fork grep hash index javascript linux logs matching moose mysqlnested parameters parsing pattern perl pid postgres process programming realmrecursive reference regex search subroutine system tag text-file times variables windows
Log into the DaniWeb communityUser NamePasswordRequest Lost username / passwordAbout Us | Contact Us | Advertise | Acceptable Use PolicyBuild Custom RSS Feed
2010 DaniWeb LLC
-
8/9/2019 In PERL Syntax
7/48
-
8/9/2019 In PERL Syntax
8/48
-
8/9/2019 In PERL Syntax
9/48
-
8/9/2019 In PERL Syntax
10/48
-
8/9/2019 In PERL Syntax
11/48
Adi kompas
-
8/9/2019 In PERL Syntax
12/48
-
8/9/2019 In PERL Syntax
13/48
-
8/9/2019 In PERL Syntax
14/48
-
8/9/2019 In PERL Syntax
15/48
-
8/9/2019 In PERL Syntax
16/48
-
8/9/2019 In PERL Syntax
17/48
-
8/9/2019 In PERL Syntax
18/48
-
8/9/2019 In PERL Syntax
19/48
robertleader
-
8/9/2019 In PERL Syntax
20/48
-
8/9/2019 In PERL Syntax
21/48
-
8/9/2019 In PERL Syntax
22/48
-
8/9/2019 In PERL Syntax
23/48
-
8/9/2019 In PERL Syntax
24/48
-
8/9/2019 In PERL Syntax
25/48
-
8/9/2019 In PERL Syntax
26/48
-
8/9/2019 In PERL Syntax
27/48
-
8/9/2019 In PERL Syntax
28/48
robertleader
-
8/9/2019 In PERL Syntax
29/48
-
8/9/2019 In PERL Syntax
30/48
-
8/9/2019 In PERL Syntax
31/48
adi robert was a great leader to the north jakarta jakarta jakarta south tangerang Cikarangworkers television announcer radio announcer
-
8/9/2019 In PERL Syntax
32/48
always follow wherever adi want to go downthe car wants to go into the office to eat want toread
-
8/9/2019 In PERL Syntax
33/48
-
8/9/2019 In PERL Syntax
34/48
-
8/9/2019 In PERL Syntax
35/48
great leaders that we need to follow
-
8/9/2019 In PERL Syntax
36/48
-
8/9/2019 In PERL Syntax
37/48
-
8/9/2019 In PERL Syntax
38/48
-
8/9/2019 In PERL Syntax
39/48
-
8/9/2019 In PERL Syntax
40/48
robertleader
-
8/9/2019 In PERL Syntax
41/48
-
8/9/2019 In PERL Syntax
42/48
-
8/9/2019 In PERL Syntax
43/48
adi robert was a great leader to the north jakarta jakarta jakarta south tangerang Cikarangworkers television announcer radio announcer always follow wherever adi want to go downthe car wants to go into the office to eat want toread
-
8/9/2019 In PERL Syntax
44/48
-
8/9/2019 In PERL Syntax
45/48
-
8/9/2019 In PERL Syntax
46/48
adi robert was a great leader to the north jakarta jakarta jakarta south tangerang Cikarangworkers television announcer radio announcer always follow wherever adi want to go downthe car wants to go into the office to eat want toread
-
8/9/2019 In PERL Syntax
47/48
-
8/9/2019 In PERL Syntax
48/48