in reply to Finding a line in a scalar, and copying it to a new scalar?
my ($a, $b, $c) = $temp =~ m/(\w+)\n/g;
(The same comment still applies re assigning to a list).
This is pretty trivial, just split on \n. eg:
#!/usr/bin/perl -w use strict; my $temp = "DATA\nFile\nHello\n"; my ($a, $b, $c) = split(/\n/, $temp); print "$a:$b:$c\n";
Although, if you have an unknown number of "lines", then you are probably better off spliting them into a list, like so:
my @list = split(/\n/, $temp);
Cheers,
Darren :)
|
|---|