in reply to using backticks to pass commands
If you don't mind installing a small module, capture from IPC::System::Simple works pretty well in my experience:
use IPC::System::Simple qw/capture/; my $snmp_trap = capture '/usr/bin/snmptrap', '-v', '2c', '-c', 'public', '127.0.0.1', '', '.3.5.6.1.4.7.34566.12343.897.0.2';
(I hope I got the args you're trying to pass correct.)
Otherwise, open would work too, although it's not as concise (e.g. open my $fh, '-|', @command or die $!; and then reading from $fh).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using backticks to pass commands
by zatarboy (Initiate) on Jan 22, 2013 at 14:25 UTC | |
by choroba (Cardinal) on Jan 22, 2013 at 15:05 UTC | |
by Anonymous Monk on Jan 22, 2013 at 15:08 UTC |