If you only have one equals sign dividing what you don't need, and what you
are looking for:

$string = "interfaces.ifTable.ifEntry.ifInOctets.4 = 954819405";
($key, $val) = split /=/, $string;

Steve H.

-----Original Message-----
From: Ask Bjoern Hansen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 3:54 AM
To: Herman Cremer
Cc: [EMAIL PROTECTED]
Subject: Re: string "cut"


On Tue, 21 Aug 2001, Herman Cremer wrote:

> Hi
> I have a string from a snmp get function...
>
> interfaces.ifTable.ifEntry.ifInOctets.4 = 954819405
>
> how can I "CUT" so the value is only 954819405 ?

with a regular expression.

  $string =~ s/.* = //;

would be one way to do it.

Another way would be

$string =~ m/ = (\d+)/;
my $value = $1;


which could be better written as:

my ($value) = ($string =~ m/ = (\d+)/);


 - ask

--
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to