Depending on your OS, you may not have "\n" in your data at all: it might be "\r\f" (CR-LF) instead (or, rarely, something else). Try:
my @foo = split "\n|\r\f", $test;
Also,
my ($test) = @ARGV will put only the first element of
@ARGV (that is,
$ARGV[0]) in
$test. Is that what you wanted?
To help debug what you've got, try this:
$test =~ s/\n/**/g; ## replace all \n with '**'
$test =~ s/\r/!!/g; ## replace all \r with '!!'
print STDERR qq/'$test'/;
If you still can't figure out what's wrong, paste the output from that, so maybe one of us will see something you're missing.
Anima Legato
.oO all things connect through the motion of the mind
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.