I
ipog_1234
Hi:
Purpose: to read .ini file to get a password for a respective user.
Problem:I was running this perl script and could not figure out how to
search for the username(here joe) and print the password.
..ini File: contains username and password with tab sequence in-between.
Code:
#!/software/bin/perl -w
use warnings;
$file='/home/work/password.ini';
$username="joe";
open(INFO, $file);
while(<INFO>){
if ( $_ ~= /^$username/ ){
($password)=split[1];
}
}
print "$password,\n";
close(INFO);
Purpose: to read .ini file to get a password for a respective user.
Problem:I was running this perl script and could not figure out how to
search for the username(here joe) and print the password.
..ini File: contains username and password with tab sequence in-between.
Code:
#!/software/bin/perl -w
use warnings;
$file='/home/work/password.ini';
$username="joe";
open(INFO, $file);
while(<INFO>){
if ( $_ ~= /^$username/ ){
($password)=split[1];
}
}
print "$password,\n";
close(INFO);