1/6 If anyone with any Perl 5.004 fu can explain the following behavior
coherently, I'd be enlightened. The file is located in
~god/Pub/perl.bugs
\_ 1. The first evaluates the backquote expression in list context
and stores the first element of the result in $result1. The
second evaluates the backquote expression in scalar context
and stores the entire result, as a string, in $result2. It
has nothing to do with your use of "my"; you can (and should)
rewrite the second as
my $result2 = `cp --help 2>&1`;
See "perldoc perlsub" for more information.
2. Both of your examples work fine for me. Could you elaborate
on what goes wrong when you try them?
3. You can't declare $_ with my. This is a special case in perl
which may change sometime; it's mentioned in "perldoc perlsub".
For now, use local instead of my for $_. |