> -----Original Message-----
> From: Paul Johnson [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 25, 2005 1:53 PM
> To: Larsen, Errin M HMMA/IT
> Cc: [email protected]
> Subject: Re: Perl One-liner de-compile?
>
>
> On Mon, Apr 25, 2005 at 01:45:15PM -0500, Larsen, Errin M
> HMMA/IT wrote:
>
> > Hi everyone,
> >
> > Here is an example from the perlrun perldoc page:
> >
> > perl -ane 'print pop(@F), "\n";'
> >
> > is equivalent to
> >
> > while(<>) {
> > @F = split(' ');
> > print pop(@F), "\n";
> > }
> >
> >
> > My question is, can I get Perl to evaluate a command line (like
> > above) and print out the equivalent code that command line will
> > produce?
> >
> > I hope that makes sense. I thought I saw something
> similar to this
> > on this list before.
>
> $ perl -MO=Deparse -ane 'print pop(@F), "\n";'
>
> --
> Paul Johnson - [EMAIL PROTECTED]
> http://www.pjcj.net
>
Ok ... So I tried this:
# perl -MO=Deparse -nae 'print $f[4]' /some/directory/somefile
LINE: while (defined($_ = <ARGV>)) {
our(@F) = split(" ", $_, 0);
print $f[4];
}
-e syntax OK
My question now is, where did the @f array come from? I searched
through the perlvar perldoc page, but I only found an explanation for
the @F array. Is this an example of Perl making a typo? Or is the @f
array a secret array I'm not cleared to know about?
--Errin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>