> -----Original Message----- > From: Kevin Old [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 04, 2004 9:38 AM > To: [EMAIL PROTECTED] > Subject: Need help with regex > > > Hello everyone, >
Hi! > I have a line like the following: > > my $line = "31232000 07/28/04 DUC000 NET 60 DAYS RD 222264 > UPSGNDSVR PREPAID"; > > What I'm looking for in lines like this are the customer number > (DUC000) and a "code" that starts with UPS, or if the code > doesn't start with UPS idealy I'd like to have whatever was > in that place returned, <<SNIP>> Does the information in your "line" above always have the same information in the same fields? For example, is the Customer number always the 3rd string of information in your line? If so, then you can grab your stuff without matching with a nice split! my( $customer, $code ) = ( split ' ', $line )[2, 8]; I hope that helps, --Errin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>