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 ;)

-----Original Message-----
From: Nat Durbin [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 15:50
To: [EMAIL PROTECTED]
Subject: newbie whitespace question



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

Reply via email to