rsiedl has asked for the wisdom of the Perl Monks concerning the following question:
My question is, how can i use what the match of (.*) was? $1 is not it.#!/usr/bin/perl use strict; use warnings; my $file = "./file.txt"; # File data looks like: (without the beginning hash) # tag: variable open(FILE, $file); if ( grep /^tag\: (.*)$/, <FILE> ) { print "Found tag: $1\n"; } # end-if close(FILE); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use regex match from file grep
by Joost (Canon) on Jun 11, 2004 at 10:03 UTC | |
by rsiedl (Friar) on Jun 11, 2004 at 12:05 UTC | |
|
Re: use regex match from file grep
by delirium (Chaplain) on Jun 11, 2004 at 12:16 UTC |