Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Look Ahead/Behind Via a File Handle

by benn (Vicar)
on Aug 11, 2003 at 23:32 UTC ( #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
Node Status?
node history
Node Type: note [id://283056]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-07-28 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (434 votes). Check out past polls.