I didn't know that usage model for strict refs. Thanks!

Though, as you & others said, the moral issues still remain with that!

-Nilanjan


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Muhlich
Sent: Thursday, October 16, 2008 2:02 PM
To: boston-pm
Subject: Re: [Boston.pm] Interpolated scalar as an lvalue?

On Thu, 2008-10-16 at 10:39 -0400, Ronald J Kimball wrote:
> On Thu, Oct 16, 2008 at 08:32:41AM -0600, Palit, Nilanjan wrote:
>
> > Perl complains about the second line in the foreach loop during run time:
> > Can't use string ("abc_type") as a SCALAR ref while "strict refs" in use at 
> > test1.pl line 19.
> >
>
> The error message explains exactly what the problem is.  You can't use
> strings as refs while "strict refs" is in use.  If you want to use strings
> as refs, turn off "strict refs".
>
> no strict 'refs';

Actually Nilanjan, you can just turn off strict refs inside the block
where you write your new code.  No need to turn it off for the entire
program.

  foreach ... {
    no strict 'refs';
    $$varname = <something>
  }
  # refs are still strict out here


 -- Jeremy


_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to