perl coding ?

Mark Ovens mark at ukug.uk.freebsd.org
Wed Apr 21 15:16:04 PDT 2004


Kirk Strauser wrote:

> At 2004-04-21T17:29:34Z, Mark Ovens <mark at ukug.uk.freebsd.org> writes:
> 
>> $dup-number = substr($dup-counter, 0, length($dup-counter) - 1);
> 
> Did you actually test that?  I'm pretty sure Perl doesn't like dashes in
> variable names:
> 
>     % perl -e '$foo-bar = 1;'
>     Can't modify subtraction (-) in scalar assignment at -e line 1, near "1;"
>     Execution of -e aborted due to compilation errors.

You are quite correct; I just copied the OP's variable names. He has 
since sent me a copy of the script and it does use '_' rather than '-' 
so I guess it was a typo in his e-mail.

Thanks for pointing it out.

Regards,

Mark




More information about the freebsd-questions mailing list