[Chicago-talk] Regular expression
cjhamil at gmail.com
Wed Feb 6 10:55:26 PST 2008
If you _really_ want a regex you could replace your spilt with this:
But the other suggestion regarding unpack() is the better option.
On Feb 6, 2008 12:50 PM, Andy Lester <andy at petdance.com> wrote:
> On Feb 6, 2008, at 12:46 PM, Young, Darren wrote:
> > Group Node Status
> > -------------------- --------------- ------
> > Cluster Group GSBDHCL2 Online <- the line
> > I'm
> > splitting on.
> If they're fixed width columns, use unpack(), like so:
> my ($group,undef,$node,undef,$status) = unpack( 'A20 A1 A15 A1 A6',
> $str );
> That's saying "Split out the first 20 alphas into $group, ignore the
> next 1, the next 15 into $node, the next 1 ignored, and the last 6
> into $status". You may need to adjust those widths, since I didn't
> count carefully, but you get the idea.
> Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
> Chicago-talk mailing list
> Chicago-talk at pm.org
More information about the Chicago-talk