hi,
A variable I parse input into in one of my programs can (and will) in certain situations be fed pure whitespace. Non-whitespace situations aren't a problem, but if it happens to receive a space, I don't want to lose it. Here's an example:
and the output is: length is: 0
Is there any way to prevent this from happening? My guess is that this whitespace-squashing is an immutable aspect of Perl, but I'm not sure. There are, of course, ways i can get around this but the cleanest/neatest would be to (in this context) have the whitespace not get squashed.
Thanks!
dora
A variable I parse input into in one of my programs can (and will) in certain situations be fed pure whitespace. Non-whitespace situations aren't a problem, but if it happens to receive a space, I don't want to lose it. Here's an example:
Code:
$var = " ";
$var2 = length $var;
print "length is: $var2\n";
and the output is: length is: 0
Is there any way to prevent this from happening? My guess is that this whitespace-squashing is an immutable aspect of Perl, but I'm not sure. There are, of course, ways i can get around this but the cleanest/neatest would be to (in this context) have the whitespace not get squashed.
Thanks!
dora