Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: File read and strip

by Andrew_Levenson (Hermit)
on Nov 14, 2006 at 20:00 UTC ( [id://584049]=note: print w/replies, xml ) Need Help??


in reply to Re: File read and strip
in thread File read and strip

The line breaks are intentional to make the final file more readable when I format it.
What does using the {parameter?} "my $line" before the (@array) do?
And, let's see if I have any idea what's going on, the second line skips a line if it starts with a #?

Thanks!

Replies are listed 'Best First'.
Re^3: File read and strip
by markh (Scribe) on Nov 14, 2006 at 20:30 UTC
    The line:
    foreach my $line (@array) {
    assigns the value from the next item in @array to the variable $line. I find this makes it eaiser to see what you are doing, rather than using $_, which I find non-intuitive.

    Yes, you are correct, that next line of code skips anything that starts with a #, so that only lines from your file that are not comments are inserted into the array that you are intending to send to the output file.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-20 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found