[ABE.pm] What's wrong with this?

Ricardo SIGNES rjbs-perl-abe at lists.manxome.org
Sat Mar 13 21:37:09 CST 2004


* Faber Fedor <faber at linuxnj.com> [2004-03-13T21:09:12]
> $arg =~  /.*tgz$/ and  print 'print is good!\n'   ; #works :-)
> $arg =~  /.*tgz$/ and `echo -e 'echo is good!\n'` ; #doesn't :-(

The second does work!  It just doesn't do what you think it should.

Backticks, aka the qx// operator, collect and return the output of the
command.  They /do not/ send it to STDOUT!  To do that, you'd need one
of these two things:

  print `echo Everybody likes echo!`; # print the collected output

  system 'echo Well, almost everyone.'; # let the output go to STDOUT

Does that make sense?  You can read about how qx// works in the "perlop"
page.

-- 
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/abe-pm/attachments/20040313/3e6dfeb9/attachment.bin


More information about the ABE-pm mailing list