Owen wrote:
On Mon, 1 Mar 2004 18:08:08 +0100
incognito <[EMAIL PROTECTED]> wrote:


open(FH, "> $pkg_filename") or die "could not create $pkg_filename";
while ($input =~ m/.../) {
       print $1;
       FH->print("$1\n") or die "could not write to $pkg_filename";
}


I would have thought that to get a $1 out of that you would have needed while ($input =~ m/(...)/) ie, brackets around what you wanted to capture.


Yes.

#! /usr/bin/perl -w

use strict;
use warnings;

my $file = "20040301-www.tgz";

$file =~ /^(\d+)/i;

print "$file contains $1\n";

_______________________
But I have a question -

Does even mentioning (?:) usage break capturing?

I get undefined errors when trying:

$file =~ /^(\d+)-www.t(?:ar.)gz/i;
print $1;

-Bill-
__Sx__________________________________________
http://youve-reached-the.endoftheinternet.org/

--
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