On Dec 6, Paul Kraus said:

>    if ($data=~m/\f([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9])/){
>       $pos=tell (FILE);
>       print "$pos --pos\n";
>       last;
>    }

You don't want tell(FILE).  You want to know WHERE in $data the pattern
matched.  For that, use the @- array (if you've got Perl 5.6 or better).

  if ($data =~ m[\f\d{2}/\d{2}/\d{2}]) {
    $p = $-[0];
    last;
  }

If you don't have Perl 5.6, you'll need to be a bit more creative:

  if ($data =~ m[(\f\d{2}/\d{2}/\d{2})]g) {
    $p = pos($data) - length $1;
    last;
  }

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


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

Reply via email to