Hi Paul,
Thx for the response

On Thu, 30 Sep 2004 15:30:06 +0200, Paul Johnson <[EMAIL PROTECTED]> wrote:
 
<<SNIP>>

> 
> Pretty close:
> 
> $ perl -MO=Deparse -l00pe's/\n/\t/;s/\"//g'
> BEGIN { $/ = "\n"; $\ = "\000"; }
> LINE: while (defined($_ = <ARGV>)) {
>     chomp $_;
>     s/\n/\t/;
>     s/"//g;
> }
> continue {
>     print $_;
> }
> -e syntax OK
> 
> which shows a little confusion over $/ and $\, and an unnecessary \ in the
> initial program.
> 
> > This taught me a lot.
> 
> Good :-)
> 
> --
> Paul Johnson - [EMAIL PROTECTED]


When I run your command line up there, I get the following:

# perl -MO=Deparse -l00pe's/\n/\t/;s/\"//g'
LINE: while (defined($_ = <ARGV>)) {
    chomp $_;
    s/\n/\t/;
    s/"//g;
}
continue {
    print $_;
}
-e syntax OK

What OS are you running?  My '-MO=Deparse' didn't create that BEGIN
Block.  I'm on Solaris, using Perl 5.6.1.  I'm just curious what the
difference is.

--Errin

BTW, I didn't know about the Deparse Pre-Compiler thing!  Thanks for
pointing it out.  It's very handy.  Why do you think Perl uses:

  while( defined( $_ = <ARGV> ) )

instead of:
  
  while( <> )

Is this example pointing out that the diamond ( <> ) operator is
really a short-cut for 'defined( $_ = <ARGV> )' ?  I'll have to go
read about this.  What is Perl protecting against by putting that
assignment in a defined()?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to