Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Open File / Search-match

by weini (Friar)
on Jan 29, 2002 at 16:29 UTC ( [id://142319]=note: print w/replies, xml ) Need Help??


in reply to Open File / Search-match

Hi Stefan, being a Perl beginner (and a german) myself, my suggestions are:

If you like perlmonks, register and log in - it's fun!

I guess the right group for your question would be "Seekers for Perl Wisdom" and not "Discussion".

Concerning your problem:

use strict; # always do so (first thing I learned) my $file = 'database'; my @result; open(INF,$file) || die "Can't open $file: $!\n"; while (<INF>) { # while walking through file if(/???/) { # if you match your searchstring # you have to replace ??? by a regex push @result,$_; # write current line to array } }
... may point in the right direction

HTH

weini

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2024-04-23 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found