Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Comma Delimitted Fields..

by Hofmator (Curate)
on Oct 19, 2001 at 18:06 UTC ( [id://119990]=note: print w/replies, xml ) Need Help??


in reply to Re: Comma Delimitted Fields..
in thread Comma Delimitted Fields..

Two small remarks:

  • for (@colors){ print "Color = $_\n"; }
    can lead to nasty surprises as you are overwriting $_ of the while loop. So either add local $_; before the loop or use a loop variable
    for my $color (@colors){ print "Color = $color\n"; }
  • if (($data[0]) && ($data[1]) && ($data[2])) {
    is quite restrictive. This doesn't allow for empty fields or lines without date. Alternatives would be if (@data == 3) or the next if suggestion by dragonchild. Of course, basicdez has to specify himself which of the alternatives fits his requirements.

-- Hofmator

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://119990]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-23 17:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found