Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: shell read of val

by roboticus (Chancellor)
on May 16, 2018 at 18:15 UTC ( #1214677=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $x = `echo foo`;
    
  2. or download this
    $ cat t.pl
    use strict;
    ...
    print "OK, command is done!\n\n";
    
    print "Now let's see what we captured:\n<$x>\n";
    
  3. or download this
    $ perl t.pl
    Let's do a command:
    ...
    Now let's see what we captured:
    <foo
    >
    
  4. or download this
    print $x;
    
  5. or download this
    my @results = `command`;
    
  6. or download this
    my @foo = grep /foo/ @results;
    
  7. or download this
    if (0 == @foo) {
        print "The command didn't find 'foo'\n";
    ...
    else {
        print "Found 'foo'!\n";
    }
    
  8. or download this
    # Do the thing
    my @results = `command`;
    ...
    else {
        print "Found 'foo'!\n";
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1214677]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-01-20 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?