Using alternate without parentheses : parentheses « Regular Expression « Perl






Using alternate without parentheses

   

#!usr/bin/perl

use strict;
use warnings;

my $string1 = "hello";
my $string2 = "hello there";
my $string3 = "hi there";

print "$string1\n$string2\n$string3\n";

print "watch this:\n";

print "1: how are you?\n" if ( $string1 =~ m/hello|hi there/ );
print "2: how are you?\n" if ( $string2 =~ m/hello|hi there/ );
print "3: how are you?\n" if ( $string3 =~ m/hello|hi there/ );

   
    
    
  








Related examples in the same category

1.Using alternate with parentheses
2.Parentheses and regex