Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Aaah. I see. It seems much more obvious to me with the reduced regexes. I've never used such extensive regexes and I think I may have been letting myself get overwhelmed and distracted by the length and complexity of these statements in comparison to the shorter more basic code I've been learning with. So in essence,
if (x = y) { print x; }
and, in simple situations
if (x = y) { print x; }
are ok, but
if (x = y) { print x; }
is not. In this stripped down form I can see how the last example, although interpreted properly by Perl, can look like a random  if (x = y) and an unrelated block of { print x; }. I'm not entirely sure of what kind of examples you are asking for, but from this node:
...
if ($Age < 13) && ($Age > 0)) { print "What are you doing here, $firstName? This Web site is strictly PG-13. Shame on you for being so naughty as to come here!"; } elsif ($Age < 18) && ($Age > 12)) { print "Not to long ago, we’d have have chased you away from our Web site. But now that you’re a teenager and mature enough for PG-13 materials, we’re glad to see you $firstName."; }
...
has the same qualities as my code and could be cleaned up (focusing on the indentation and curly braces) by saying:
if (($Age < 13) && ($Age > 0)) { print "content"; } elsif (($Age < 18) && ($Age > 12)) { print "content"; }
or even:
if (($Age < 13) && ($Age > 0)) { print "content"; } elsif (($Age < 18) && ($Age > 12)) { print "content"; }
Thank you again for taking time out to help me grasp the fundamentals. Please let me know if I am missing your point. I enjoy Perl (and learning programming in general) and feel I have been progressing rather quickly, but I want to squash bad habits and form a good foundation in style and understanding before moving to some of the more complex concepts and modules in Perl.

In reply to Re^6: Regex help/ Lua parse by marquezc329
in thread Regex help/ Lua parse by marquezc329

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 rifling through the Monastery: (3)
As of 2024-04-24 05:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found