Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^5: File reading with hashes

by poj (Curate)
on Aug 09, 2013 at 13:21 UTC ( #1048767=note: print w/ replies, xml ) Need Help??


in reply to Re^4: File reading with hashes
in thread File reading with hashes

Is it possible a user has a folder called MY_FILE ? . If so, this code should find it .

foreach my $user (keys %users) { my $fh; my $file = "$users{$user}/$fname"; if (-d $file){ print "$file is directory for user $user\n"; } elsif (-e $file ) { open ($fh, '<', $file) or warn "Could not open $file for user $use +r :$!" ; while (my $line = <$fh>) { if ($line =~ /S_REG_PORT_NO=(\d+)/) { print " $user --> $1\n"; } } } else { print "$file does not exist for user $user\n"; } }
poj


Comment on Re^5: File reading with hashes
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2014-07-26 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls