Given Perl's

    $_ = "123 foo";

    s/^(\d+)\s+//;
    $pid = $1;

    print "$_\n$pid\n";

all I can come up with is

    line = "123 foo"

    pid = nil
    line.sub!(/^(\d+)\s+/) {pid = $1; ''}

    puts line, pid

Is there a better way perhaps?

-- 
Jos Backus                       _/  _/_/_/      Sunnyvale, CA
                                _/  _/   _/
                               _/  _/_/_/
                          _/  _/  _/    _/
jos at catnook.com        _/_/   _/_/_/          require 'std/disclaimer'