Niko zuna wrote:
Hi!I made this short script in order to see if there is posible to run "modified" unix commands from a Perl script. #!/usr/bin/perl use strict; use warnings; my $load = `uptime | awk '{print $8 $9 $10 $11 $12}'`; print "$load\n"; when I am trying to run this skript, I get the whole uptime output, not only the load averages: x x x
Do you mean something like this? #!/usr/bin/perl use strict; use warnings; my $uptime = `uptime`; my @items = split ' ', $uptime; my $load = join( ' ', @items[ 7 .. 11 ] ); print "$load\n"; __END__ -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
