Jerry Preston wrote:
> 
> Hi!

Hello,

> I am trying to breakdown the following:
> 
> Pin 60 contacted, height = -11, counter = 1
> 
> with
> 
> /(\w+)\s+(\d+)\s+(\w+),\s+(\w+)\s+\=\s+-(\d+),\s+(\w+)\s+=\s+(\d+)/;
> 
> Pin 20 contacted, height = 8, counter = 1
> 
> 
> /(\w+)\s+(\d+)\s+(\w+),\s+(\w+)\s+\=\s+(\d+),\s+(\w+)\s+=\s+(\d+)/;
> But, I would like to do this in one line of code and $5 (-11,8) as such
> and not have break out the '-' on the -11.
> 
> How do I do this?

If you just want the numbers from the string:

$ perl -le'
my $string = "Pin 60 contacted, height = -11, counter = 1\n";
my @nums = $string =~ /-?\d+/g;
print "@nums";
'
60 -11 1


John
-- 
use Perl;
program
fulfillment

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

Reply via email to