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

Re: Newbie Tainted glob question

by chipmunk (Parson)
on Oct 24, 2001 at 20:42 UTC ( [id://121178]=note: print w/replies, xml ) Need Help??


in reply to Newbie Tainted glob question

You could use readdir instead. It's a bit verbose relative to using glob, but it works.
#!/usr/bin/perl -wT use strict; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; my $dir = '/var/www/htdocs'; opendir(DIR, $dir) or die "Can't opendir $dir: $!\n"; my @entries = map { /\.html\z/ ? "$dir/$_" : () } readdir(DIR); closedir(DIR);
The map is doing two things here: grabbing only the files that end in .html, and prepending the path to mimic the behavior of the glob.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found