> >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 applies for alot (all?) of Perl5 functions. The default value is always
(as far as I know) $_ or @_ depending on the context.

Both the following would work:

with($foo){
   print "I am not a $foo\n";
  # or:
   print "I am not a ";
   print;
}

The idea for this style of C<With>, came because I don't see why the default
has to always be $_. Often the amount of code required would be able to be
dramatically reduced if 'default value'  was userdefinable for blocks with
the With command.


(All opinions in this post are not representative of Monkey Coward)


Reply via email to