Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Parsing list

by vinoth.ree (Prior)
on Mar 02, 2014 at 08:31 UTC ( #1076706=note: print w/ replies, xml ) Need Help??


in reply to Parsing list

In Perl a very useful function is split, which splits up a string and places it into an array.

For Example,

my $str = "user:group:root:testing"; @user = split(/:/, $string);

Here @user holds the details of the $str.

As in your case you have only two fields delimited by ':', you can directly split and save the values into the variables as below,

my $yourstr = "user:pass"; my ($User,$Pass) = split (/:/,$yourstr); print "User:$User\n"; print "Pass:$Pass\n";

All is well


Comment on Re: Parsing list
Select or Download Code
Re^2: Parsing list
by jms53 (Monk) on Mar 02, 2014 at 12:50 UTC
    It also looks like a CSV format.
    csv
    J -

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2015-07-03 12:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls