Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re (tilly) 1: Call for code samples!

by tilly (Archbishop)
on Nov 15, 2001 at 18:15 UTC ( [id://125567]=note: print w/replies, xml ) Need Help??


in reply to Call for code samples!

A trick for the global matching that I have had occasion to use in the past.

I was trying to parse a fixed delimited report. But the locations of the columns was not fixed. However there was a header, something like this:

Here Be Many Columns -------- ---------- ---------
To locate the positioning of the columns I found the line with the underlines and then:
my @space_loc; while ($line =~ / /g) { push @space_loc, pos($line); }
You can also put together a small "parse engine" as a demo of \G matching. Handling the CSV spec might be a good example.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://125567]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found