Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

How to store each line into different variable??

by sam_0056 (Initiate)
on Sep 06, 2006 at 11:54 UTC ( #571424=perlquestion: print w/replies, xml ) Need Help??

sam_0056 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on How to store each line into different variable??

Replies are listed 'Best First'.
Re: How to store each line into different variable??
by davidrw (Prior) on Sep 06, 2006 at 12:01 UTC
    what did you try so far?

    If it's _always_ (as in completely written in stone) exactly two lines, then just declare them and populate w/split:
    my ($line1, $line2) = split /[\r\n]+/, $message;
    If anything other than that, then you're probably better off w/an array:
    my @lines = split /[\r\n]+/, $message; print "Line1: " . $lines[0];

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2023-02-04 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (31 votes). Check out past polls.

    Notices?