in reply to declaration of variables
I have no idea where you got that from. The simplest explanation would be that it is a typo and that you in fact meant:m ($var) = "";
If that is what you meant, read no further.my ($var) = "";
is basically equivalent with:m ($var) = "";
which of course is an error, namely:$_ =~ m/$var/ = "";
Can't modify pattern match (m//) in scalar assignmentBut had your example shown just:
that code would have compiled to:m ($var);
if you don't use use strict; (which you don't in your example). A scary thought.$_ =~ m/$var/;
Therefore, once again, always use strict; (and use warnings; if you're using Perl 5.6.0 or later).
Liz
Update:
Made a little clearer with what I meant with "It".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: declaration of variables
by tsee (Curate) on Sep 02, 2003 at 09:23 UTC |