Code seems to work, but it is better in PERL way as below.
use strict; use warnings; print "RegEx Engine 1.0\n________________\n"; print "Gimme a string: "; my $str = <STDIN>; print "Gimme a RegEx: "; my $pattern = <STDIN>; my $answer = ($str =~ /$pattern/); if ($answer) { print "Yes!"; } else { print "No."; } print "\nkthxbye\n";
Code Change at line "my $answer = ($str =~ /$pattern/);" will look for the pattern in $pattern in the string $str and will result in yes or no.
In reply to Re: Idiomatic Perl?
by karthiknix
in thread Idiomatic Perl?
by thenextfart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |