PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "WORENKLEIN, David, GCM" <David dot Worenklein at gcm dot com>
Subject: RE: problem with using variable
Date: Jul 21 2003 8:59PM

If the data file was created on Windows, and you are running on Unix, you
might have a problem with CR-LF.

The chomp is actually superfluous -- the s/\s*$// will get rid of the
ending new line character.  However, in his answer, Mike left off the third
slash.

-----Original Message-----
From: Sabherwal, Balvinder (MBS)
[mailto:Balvinder.Sabherwal@mortgagefamily.com] 
Sent: Monday, July 21, 2003 1:37 PM
To: 'WORENKLEIN, David, GCM'
Cc: 'sybperl-l@peppler.org'
Subject: RE: problem with using variable

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??