Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: substr Rampage

by bruceb3 (Pilgrim)
on Sep 17, 2007 at 09:35 UTC ( [id://639370]=note: print w/replies, xml ) Need Help??


in reply to substr Rampage

That is great use of the Perl built in function 'index'. Let me introduce you to another Perl built in function. This one is called 'split'.

To read the password file try something like this code..

open my $passwdfh, "<", "/etc/passwd" or die "couldn't open the passwo +rd file: $!\n"; while (<$passwdfh>) { next if /^\s*#/; # comments in the password file? chomp; my ($login, $passwd, $uid, $gid, $gcos, $home, $shell) = split /:/; # do stuff with the entries from the password file now ... next if $uid < 1000; # .. for example. } close $passwdfh;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found