At 15:49 09.07.2001 -0700, Wagner-David wrote:
> Change:if ( /^Kilobytes:(.*)$/ ) to if ( /^Kilobytes:\s*(\d*)$/ )
>
> where $1 will have your count without leading spaces. You may want
>a test to verify that you did get a hit on digits.
>
>Wags ;)
>
That only works if the text following Kilobytes: is always some spaces and
then a string of numbers. What if you've got non-numbers?
how about:
if(/^Kilobytes:[\s\t]*([^\s\t]+)$/)
which adds the possibility of tabs being used instead of spaces (just in
case :)
>Hi,
>
>I have a newbie whitespace question. Say I have a regular variable that has
>a string in it with something like " text". I just want to reassign the
>variable to the text inside the double quotes above. or, given the
>snippet...
>
>my $var="";
>while ( <FILE> ) {
> if ( /^Kilobytes:(.*)$/ ) {
> $var = $1 ;
> }
>}
>
>This will set $var to " 3452" for example, I want to strip out the
>whitespace to only get "3452".
>
>Any thoughts appreciated,
>
>-Nat
Aaron Craig
Programming
iSoftitler.com