Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Assigning output of unix command to a variable

by bichonfrise74 (Vicar)
on Dec 23, 2009 at 01:34 UTC ( #814036=note: print w/replies, xml ) Need Help??

in reply to Assigning output of unix command to a variable

What do you mean by "can't get past the '|' in the nslookup"? Consider this example.
#!/usr/bin/perl use strict; my $node = qx( nslookup | awk -F Name: '{ print \$2 }' ); print $node;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://814036]
[thepkd]: ??
[GotToBTru]: I would think temporary variables would help in making the real life meaning of your structure clear
[choroba]: the problems start when you want to "skip a level", i.e. the arrays for all the keys
[LanX]: what are temps?
[moritz]: oh, the question was about creation, not indexing
[thepkd]: temporary variables
[moritz]: [ { a => [ { b => 1 } ] } ]
[choroba]: dereference ne creation
[choroba]: at least in my lingo
[moritz]: .oO( oh temps, oh moritz )

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2016-12-06 13:18 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (104 votes). Check out past polls.