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

Re: Can I open a specific file (eg. '.log') without knowing the actual name of it?

by Adam (Vicar)
on Apr 06, 2001 at 20:37 UTC ( [id://70597]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Can I open a specific file (eg. '.log') without knowing the actual name of it?

glob.
use strict; use IO::File; my @logFiles = glob( '*.log' ); my @data; for ( @logFiles ) { # You can further limit your file names thusly: die "Weird File Name" if m/[^a-zA-Z0-9._-]/; my $fh = IO::File->new( '< $_' ) or die "Open Failed for '$_', $!"; push @data, <$fh>; # Do something with the file $fh->close(); }
  • Comment on Re: Can I open a specific file (eg. '.log') without knowing the actual name of it?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://70597]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.