Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Asmo,

As others, i will commend your attempting to explore the perl language and learn it better. However, Learning perl through obfuscations is not a very good way to learn perl. This is in particular due to strict and warnings.

When first learning perl it might seem easier to ignore warnings and strict, when in fact this is false laziness. The path to true laziness would learn strict and warnings now so that they are easier to incorporate with knowledge later. With that in mind, if we were to rewrite your node with strict and warnings, we would only need to change code in two places*:

# change @a on first line to: my @a = ("... # change the for loop at the end so that $a is declared: foreach my $a (@a) {print chr(length $a)} # or change the for loop to use $_ instead of $a :) foreach (@a) {print chr length}
A better way to learn (AFAIK) would be to pick up the Llama book and read the chapters followed by doing the examples. To end with, here are some good nodes on learning perl:

jynx


* not counting the shebang line and the use strict; lines.


In reply to On exploring Perl by jynx
in thread Another 'ode to backslash' ;-) by Asmo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-24 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found