Why Am I Getting a Compile Error?

Why Am I Getting a Compile Error?

Post by Jeff Westm » Fri, 28 Mar 2003 03:35:41

This doesn't make sense to me:

line 129:  $ordCnt = trim($result[16]);

sub trim($) {
    my $arg = shift;
    $arg =~ s/^\s+//;
    $arg =~ s/\s+$//;
    return $arg;


$ perl -c conv.pl
syntax error at conv.pl line 129, near "result["
conv.pl had compilation errors.

"trim" works fine if I pass it a quoted literal such as '"  25  "'.  Why
won't it work with an element reference?!


Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!