If you want to, STDIN and STDOUT can be used (and are assumed). while (<>) { # keep lines that start with digits print $1 if m/^[0-9]+ ([^ ]+)$/; } --Skip -----Original Message----- From: wlug-admin@mail.wlug.org [mailto:wlug-admin@mail.wlug.org]On Behalf Of Mike Peckar Sent: Tuesday, December 04, 2001 10:17 AM To: wlug@mail.wlug.org Subject: [Wlug] perl wus o.k., I admit it, I suck dead donkey dicks in hell at this. I know I can do gooder - maybe you can help. The perl below works, I just think its real ugly and I can't stand the thought that the same thing using awk is simply: cmd | awk '{ if ($1 ~ /^[0-9]*$/) {print $2}}' >> $outlist One place I'm lost is with embedding carriage returns, which awk does so nicely. I played with arrays, stripping extra \n's after the loop, then after adding the stupid if statement below to prevent the extra blank line, I just gave up thinking I need a really good flogging. It was at this point I started to regret every brain cell I lost between 1976 and 1986, so I decided to ask you so I could get on with my life... open( IN, "$cmd |"); while (<IN>) { ($f1,$f2) = split(' ', $_); if ( $f1 =~ /^[0-9]*$/ ) { if ( $list ) { $list = "$list\n$f2" } else { $list = $f2 } } } close IN; open ( OUT, ">$oulist"); print OUT "$list"; close OUT; thanks, Mike _______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug