[Chicago-talk] Regular expression

Andy Lester andy at petdance.com
Wed Feb 6 11:19:42 PST 2008


On Feb 6, 2008, at 1:14 PM, Young, Darren wrote:

> I've tested it on a couple of other clusters and found it's not fixed
> width.
>>
>>
>> Young,> Group                Node            Status
>> Young,> -------------------- --------------- ------
>>


It looks fixed width between each run.  Count the dashes on the second  
row and you'll have it.

my (undef) = <>; # skip headings
my $dashes = <>; # dashes
chomp $dashes;

my @dashes = split( /\s+/, $dashes );  # Make an array of each line of  
dashes
my @widths = map { length } @dashes;   # And get the length of each one
my $mask_for_unpack = sprintf( 'A%d A1 A%d A1 A%d', @widths );

xoxo,
Andy

--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance






More information about the Chicago-talk mailing list