SPUG:array arg to push

Michael R. Wolf MichaelRunningWolf at att.net
Fri Mar 21 23:35:57 CST 2003


Has anyone used an expression as the first argument to push?  I know
that there's something special about the prototype of the builtins so
that they can take an array as the first argument without expanding
it, but had hoped that I could have an expression as the first
argument.  

This doesn't work.  Ideas?

    my ($min, $max) = (1, 10);
    foreach ($min..$max) {
        push(($_%2 ? @odd : @even), $_);
    }

    print "even: @even\n";
    print "odd: @odd\n";

-- 
Michael R. Wolf
    All mammals learn by playing!
        MichaelRunningWolf at att.net




More information about the spug-list mailing list