|
|
sybperl-l Archive
Up Prev Next
From: "Sabherwal, Balvinder (MBS)"
<Balvinder dot Sabherwal at mortgagefamily dot com>
Subject: RE: problem with using variable
Date: Jul 21 2003 5:36PM
For some reason, chomp is not getting rid of the new line character at the
end of the line which is messing things up. Any Ideas as why chomp could be
failing??
Thanks
-----Original Message-----
From: WORENKLEIN, David, GCM [mailto:David.Worenklein@gcm.com]
Sent: Monday, July 21, 2003 1:30 PM
To: 'Sabherwal, Balvinder (MBS)'
Subject: RE: problem with using variable
When you print the password to see what it is, make sure you use
print "'$pwd'\n";
The extra single quotes may help you spot something
-----Original Message-----
From: Sabherwal, Balvinder (MBS)
[mailto:Balvinder.Sabherwal@mortgagefamily.com]
Sent: Monday, July 21, 2003 8:30 AM
To: 'mpeppler@bluewin.ch'; David Owen
Cc: 'sybperl-l@peppler.org'
Subject: RE: problem with using variable
Importance: High
>>
>>Yes, that's exactly what happens - the foreach loop sets the value of
>>$pwd for use inside the loop, but it clears it before exiting the loop.
>>
>>If your file has a single password in it I'd maybe use something like
>>this:
>>
>>{
>> local $/ = undef; # read the entire file in one go
>> open(IN, "/tmp/passwd") || die "Can't open pwd file: $!";
>> $pwd = ;
>> $pwd =~ s/\s*$/; # remove any trailing spaces
>> chomp($pwd);
>> close(IN);
>>}
This still is not helping. I tried and the script is still acting the same.
I did added the print after the block of code to make sure $pwd has right
value and it dose. Any more clues??
|