in reply to Smartest Way To Split

The answer depends on how rigid and accurately followed the data format is. If those are fixed-width fields, unpack may be best. If it's always the same fields highlighted by stars, split will be fine. Here's a way to get just the highlighted ones, wherever they are:

while (<$fh>) { my @star_fields = m/\*([^*]*)\*/g; # . . . }

Note the escapes for literal '*'. I imagine those were what were giving you trouble. They will need to be escaped for a split pattern, too.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Smartest Way To Split
by Thilosophy (Curate) on Mar 01, 2005 at 03:52 UTC
    Note the escapes for literal '*'. I imagine those were what were giving you trouble

    I'd imagine that the asterisks are only there for our benefit. But I could be wrong. I think ellem will have to specify more clearly how the split is supposed to work.