On Wed, Apr 9, 2008 at 4:27 PM, Michael Barnes <[EMAIL PROTECTED]> wrote: > I have a list of strings like this: > > 060001_000 > 060001_001 > 060001_002 > 060001_003 > 060001_004 > 070002_000 > 070002_001 > 070002_002 > 070002_003 > 070002_004 > > The position and value of the digits are significant. > > The first two digits give me a channel, i.e. 06=channel 1, 07= channel > 2, etc. > > The sixth digit gives me the day of the week, i.e. 1=Monday, 2=Saturday, > 4=Thursday, etc. > > The last two digits give me a time reference, i.e. 01=00:00:00, > 02=00:30:00, 10=03:00:00, 11=03:30:00, etc. snip
Sounds like a job for a regex: my ($channel, $day, $time) = $string =~ /([0-9{2})[0-9]{3}([0-9])_[0-9]([0-9]{2})/; Remember to check the variables for defindedness (in case the match fails). -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/