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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Parsing list
by jms53 (Monk) on Mar 02, 2014 at 12:50 UTC |
In Section
Seekers of Perl Wisdom