andrewbriggs has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w print "Enter number : "; my $num = <STDIN>; chomp($num); @nums = split /(?<=[\d])/, $num; $i = 0; foreach (@nums) { if ($num =~ /[$i]{$_}/) { print "true" } else { print "false"; } $i++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex not working
by jwkrahn (Abbot) on Oct 07, 2011 at 07:54 UTC | |
|
Re: regex not working
by AnomalousMonk (Archbishop) on Oct 07, 2011 at 05:14 UTC |