On Jun 25, BOLCATO CHRIS (esm1cmb) said:

>I am having a problem with memory parenthesis.  In the following piece of
>code the pattern matches but the $1 $2 $3 $4 variables are null.  I can tell
>the pattern matches because @foo has the line that matches.  Any help would
>be greatly appreciated.
>
>@foo = grep(/^"$var",.+,.+,"(.+)","(.+)","(.+)","(.+)",.+$/,@file);
> print "$1 $2 $3 $4";

Is there only ONE element in @file that will match?  If so, don't use
grep().

  my ($line, $f1, $f2, $f3, $f4);
  for (@file) {
    if (/^"$var",.+,.+,"(.+)","(.+)","(.+)","(.+)",.+$/) {
      ($line, $f1, $f2, $f3, $f4) = ($_, $1, $2, $3, $4);
    }
  }

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to