Thanks a bunch Timothy and Charles for guiding me to wonderful resources within the Perl system.
use diagnostics qw/-verbose/; it slipped my attention. (Courtesy : Charles) 'perldoc -f qw (Courtesy : Timothy) Actually I am a guiding junior Perl programmers (having little or no prior experience in Perl) and I am in the process of preparing a document with suitable code snippets which includes the most common Perl programming errors and warnings. Your valuable input is highly appreciated and I cherish the treasure which I learned from you. best, Shaji ------------------------------------------------------------------------------- Your talent is God's gift to you. What you do with it is your gift back to God. ------------------------------------------------------------------------------- ________________________________ From: timothy adigun <2teezp...@gmail.com> To: *Shaji Kalidasan* <shajiin...@yahoo.com> Cc: Perl Beginners <beginners@perl.org> Sent: Wednesday, 29 May 2013 9:26 AM Subject: Re: Perl error codes and warnings Hi Shaji, On Wed, May 29, 2013 at 4:19 AM, *Shaji Kalidasan* <shajiin...@yahoo.com> wrote: Greetings, > > >Where can I get more information on Perl's most common error codes? Is there a >single source (repository/resource) for such most frequently encountered error >codes? > > >[code-1] >use strict; >use warnings; > >my @names = qw/bat, ball, %&!*, king, (^@), eagle, zebra/; > with "qw", you don't use a 'comma' to separate the element of the array. Because, the element are separated by space. So, the correct thing to do is: my @names = qw/bat ball %&!* king (^@) eagle zebra/; foreach (@names) { > print "$_\n" if /\w/; >} >[/code-1] > > >[output-1] >Possible attempt to separate words with commas at C:/Users/shaji >kalidasan/workspace/juno-sr1/shaji/Shaji Code Snippets/hari.pl line 4. >bat, >ball, >king, >eagle, >zebra >[/output-1] > > >[code-2] >use strict; >use warnings; > >my @names = qw/orange apple %&!*# banana (^@) grapes mango/; > Also, with "qw", you can't use '#', the use warnings gives a warning that the string contain '#'. So, to use your expression, you can do like so: my @names = split/\s/, q/orange apple %&!*# banana (^@) grapes mango/; foreach (@names) { > print "$_\n" if /\w/; >} >[/code-2] > > >[output-2] >orange >apple >banana >grapes >mango >Possible attempt to put comments in qw() list at C:/Users/shaji >kalidasan/workspace/juno-sr1/shaji/Shaji Code Snippets/hari.pl line 4. > >[/output-2] > > >So considering these two programs mentioned above, I am getting the following >warning messages > > >1) Possible attempt to separate words with commas at C:/Users/shaji kalidasan/workspace/juno-sr1/shaji/Shaji Code Snippets/hari.pl line 4. > > >2) Possible attempt to put comments in qw() list at C:/Users/shaji kalidasan/workspace/juno-sr1/shaji/Shaji Code Snippets/hari.pl line 4. > > >Please suggest some pointers or resources for this type of frequently >encountered error codes/warnings and its possible meanings. > In fact, if you do 'perldoc -f qw' from the Command Line Interface, the last paragraph says: A common mistake is to try to separate the words with comma or to put comments into a multi-line "qw"-string. For this reason, the "use warnings" pragma and the --ww switch (that is, the $^W variable) produces warnings if the STRING contains the "," or the "#" character. Hope this helps