Basically, what I want to do here is catch the output from ps. The ultimate goal is to find processes meeting certain criteria (not yet detailed) and kill them. One of the things I'll want to do is find out how long a process has been running, so essentially I'm trying to extract the date from ps and convert it to epoch seconds so that I can make a neat subtraction. Among other things, I'm lousing up the first pattern match. The string would look something like: root Wed Aug 22 04:44:59 2001 DLs I was fussing with split, but the delimiters are inconsistent--could be one space, could be four spaces depending on the length of the user name etc, and I want to pass the entire date section to the subroutine in one scalar. If anyone has any advice, that'd be swell. Obviously, I barely know what the heck I'm doing with pattern matches, and the design itself may be flawed. (And in any case, not everything is in the program; I ripped a bunch of stuff out--including the strict pragma until such time as I know how far down my wrongness goes.) Such are the costs of an inconsistent education ;) Thanks, John =============================================== #!/usr/bin/perl use warnings; use Time::Local; sub convert($); @procs=`ps axo user,lstart,state`; shift @procs; #REMOVE HEADER LINE my $currentdate = convert(`date`); ###ARRGH for(@procs){ chomp; $_ =~ /^([a-z]+)\b(\w.*\d{4})\s+?(\S+?)$/; print "$1\t$2\t$3\n"; } #============================================================== sub convert { my $datetime = shift; my ($day, $month, $mday, $time, $zone, $year,$hour, $min, $sec) = "null"; if($datetime =~ /PDT/){ ($day, $month, $mday, $time, $zone, $year)=split (/\s+?/, $datetime); ($hour, $min, $sec)= split (/:/, $time); }else { ($day, $month, $mday, $time, $year)=split(/\s+/, $datetime); ($hour, $min, $sec)= split (/:/, $time); } return(timelocal($sec,$min,$hour,$mday,$month,$year)); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]