On 11-09-27 05:30 PM, Chris Stinemetz wrote:
Trying to match the what is contained in $what 3 consecutive times.
But I am getting the followoing error:
Use of uninitialized value $_ in pattern match (m//) at ./ex9-1.pl line 7.
The program:
#!/usr/bin/perl
use warnings;
use strict;
my $what = 'fred|barney';
if (/($what){3}/) {
# This is a short cut of:
if( $_ =~ m/($what){3}/ ){
# $_ has nothing in it
print $what;
# If you want what was matched:
if( m/((?:$what){3})/ ){
print $1, "\n";
}
--
Just my 0.00000002 million dollars worth,
Shawn
Confusion is the first step of understanding.
Programming is as much about organization and communication
as it is about coding.
The secret to great software: Fail early & often.
Eliminate software piracy: use only FLOSS.
"Make something worthwhile." -- Dear Hunter
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/