Welcome Guest!
 chicago-pm
 Previous Message All Messages Next Message 
Re: Safe Shell Escapes  Andy_-@wiwb.uscourts.gov
 Jun 09, 2004 12:22 PDT 

if (open(PROGRAM, "-|")) {
        @lines = <PROGRAM>;
        close PROGRAM;

perldoc -f open says:
the
                  filename is interpreted as a command to which output
                  is to be piped, and if MODE is '-|', the filename is
                  interpreted as a command which pipes output to us.
                  In the 2-arguments (and 1-argument) form one should
                  replace dash ('-') with the command.

as in:
open(ARTICLE, '-|', "caesar <$article")     # decrypt article
                          or die "Can't start caesar: $!";

Now I see down in the examples:
open(FOO, '-|') || exec 'cat', '-n', $file;

which is (?) like:
if ( open(FOO, '-|') ) {
....
} else {
    exec 'cat', '-n', $file;
}

But that seems to be ... er time travel or missing a loop.

a

Andy Bach, Sys. Mangler
Internet: andy_-@wiwb.uscourts.gov
VOICE: (608) 261-5738 FAX 264-5932

Beware of bugs in the above code; I have only proved it correct, not tried
it. -- Donald Knuth
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.