> Why would you want it to print Monkey Hero, I would expect $_ to be
> localized, rather than global, which could prove more convenient.
No, it's still localized.
But the With would mean that $_ in a way becomes a normal variable like $foo
was, and the $foo is now the 'default variable'.
> 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";
> Like "I am not a
> coward" which can be easily done with print "I am not a $_"; will now have
> to be written in two separate lines, and possibly more if there is more to
> follow.
>
> Ilya
Um, of course the original way is still possible!
> >Then how would you write "I am not a coward"
>
> with ($foo)
> {
> print "I am not a"; ##What do I use here or do I have to issue a
>##separate print like...
> print;
> }
>
> Ilya
Well in Perl5, for the print to use default value it's just 'print;'. The
same applie
> > So, in this case, a "with" synonym for "for" would work.
> >
> Particularly if '$_' was implied... So with Perl 6's '.' replacing '->',
> and 'with' aliasing 'for':
>
>with ( $XL.{Application}.{ActiveSheet} ) {
> .cells(1,1) = "Title";
> .language() = "English";
>}
This is m
> > So, in this case, a "with" synonym for "for" would work.
> >
> Particularly if '$_' was implied... So with Perl 6's '.' replacing '->',
> and 'with' aliasing 'for':
>
>with ( $XL.{Application}.{ActiveSheet} ) {
> .cells(1,1) = "Title";
> .language() = "English";
>}
This is m