in reply to Regex Matching

Assuming the data is in $line, you could do any of the following :

1. my ($fieldA,$fieldB,$fieldC,$fieldD) = unpack("a1a20a20a5",$line);
2. $line =~ m/(.)(.{20,20})(.{20,20})(.{5,5})/; ## note, \s is part of .
3. $fA = substr($line,0,1);$fB = substr($line,1,20); ## etc...

may the foo be with you

Replies are listed 'Best First'.
Re: Regex Matching
by Abigail (Deacon) on Jul 05, 2001 at 19:26 UTC
    There is no need to write {20,20} in your regex. {20} means the same, is less typing, and, IMO, easier to read.

    -- Abigail