Why would you want it to print Monkey Hero, I would expect $_ to be
localized, rather than global, which could prove more convenient.

Ilya

-----Original Message-----
From: Stuart Rocks
To: [EMAIL PROTECTED]
Sent: 07/19/2001 1:13 PM
Subject: Re: what's with 'with'?  (was: [aliasing - was:[nice2haveit]])

> But can someone reiterate the
> difference between the above and
>
> for($foo){
>    print "I am not a $foo\n";
>   # or:
>    print "I am not a ";
>    print;
> }

Try this under the current for system, cause it's unclear what will
happen
for those new to Perl:

  $foo="monkey";  $_=" coward";
  for($foo){
    print;
    $_ = " hero";
  }
  print;

What is printed is "monkey coward", rather than "monkey hero". In
addition,
$foo is now " hero".

I suppose there isn't a huge difference. Either way, all this talk has
probably taken longer than it would take to write the thing.

Reply via email to