in reply to Slice misuse ?

Always add use strict; use warnings; at the start of your script. If you had done so you would have received the error:

print (...) interpreted as function at ...

and saved everyone some time. :)


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Slice misuse ?
by blogical (Pilgrim) on Aug 07, 2006 at 22:06 UTC

    I had yet to run it in context, where I DO have warnings and strict on. I encountered the error while running perl -c on a mason component I wrote.

    my $id = $ARGS{to} || ( $m->dhandler_arg =~ /^(\w+)\/pledge/ )[0]; is the offending line. ( $m->dhandler_arg =~ /^(\w+)\/pledge/ )[0] seemed to be the offending part, so I pulled it out for examination.

    I used a print statement for testing. I should have run perl -We instead of -e on my test case. Also, I should have used a more accurate test case, as I seem to have gone hunting for the a problem I didn't originally have (and found it!)

    "One is enough. If you are acquainted with the principle, what do you care for the myriad instances and applications?"
    - Henry David Thoreau, Walden