Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Look Ahead/Behind Via a File Handle

by benn (Vicar)
on Aug 11, 2003 at 23:32 UTC ( [id://283056]=note: print w/replies, xml ) Need Help??


in reply to Look Ahead/Behind Via a File Handle

As Zaxo says, using SQL::Statement, or a parsing module of some kind may be easier, but I think your problem could be solved simply using another 'inner' read...something like this (untested!).
while (my $line = <SCHEMA>) { if ($line =~/create table \".+?\"\.(.+?)$/mos) { $table_nm = $1; print BIGLIST "$1 \n"; my $keep = 0; while ($line = <SCHEMA> && $line ne ')') { $table_hash{$table_nm} = 1 if ($line =~ /$var_of_interest/); } } }
Cheers,
Ben.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found