in reply to Split/Parameter Problem

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

Replies are listed 'Best First'.
Re^2: Split/Parameter Problem
by sgifford (Prior) on Jan 06, 2005 at 19:38 UTC
    Or
    split(/\Q$RS\E/,$test);
    to split on the contents of Perl's current line seperator.