0

Hello all.
I have a small problem, the next code finds the neden content, but it doenst print it:

$string = "#324423asdd asd 'BecamePosters' ";
if($string =~ m/'[a-zA-Z]{1,40}'/) {
print "ok!\n";
print $1;
} else {
print "not ok!\n";
}

It only prints "ok!\n" but nothing more.
Also triyed m/'*'/ but i get the same result, any sujestions ?

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by jen140
0
#!/usr/bin/perl -w
use strict;
my $string = "#324423asdd asd 'BecamePosters' ";
if($string =~ m/('[a-zA-Z]{1,40}')/) { #Put parentheses around what should be $1
print "ok!\n";
print $1;
} else {
print "not ok!\n";
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.