in reply to Re^3: Perl : Split/Regex
in thread Perl : Split/Regex
Reads better perhaps, but doesn't actually work. First argument to push must be something starting with the @ sigil or, with Perl 5.14+, a reference to an unblessed array.
c:\@Work\Perl>perl -wMstrict -le "print $]; ;; my (@streams, @spaces); my $y = 'Y'; push (($y eq 'Y' ? @streams : @spaces), 'Z'); print qq{(@streams) (@spaces)}; " 5.014004 Not an ARRAY reference at -e line 1. c:\@Work\Perl>perl -wMstrict -le "print $]; ;; my (@streams, @spaces); my $y = 'Y'; push (($y eq 'Y' ? \@streams : \@spaces), 'Z'); print qq{(@streams) (@spaces)}; " 5.014004 (Z) ()
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Perl : Split/Regex
by GrandFather (Saint) on Sep 04, 2014 at 01:48 UTC | |
by AnomalousMonk (Archbishop) on Sep 04, 2014 at 02:22 UTC |