Reply to comment

shift, split

#!/usr/local/bin/perl -w

$uptime = `uptime`;
$uptime =~ s/[ \n\t\f\s,]+/ /g;
$uptime =~ s/^[ \n\t\f\s]//;
chomp($uptime);

@array = split(/ /, $uptime);
while (@array) {
$thing = shift(@array);
print "$thing\n";
}

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.