From 5ec66997df9bd7d210fce05b85bdb4121bb869b4 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 4 Jan 2011 22:06:45 -0500 Subject: [PATCH] more with operators --- cli/operators.pl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/cli/operators.pl b/cli/operators.pl index c2dfd12..a955f40 100644 --- a/cli/operators.pl +++ b/cli/operators.pl @@ -102,3 +102,33 @@ if (($a == 5 && $b == 2) or $c == 3) { if ($a == 4 && $b < 3) { printcookies(); } + +sub foo { + return ($c eq 0); +} + +foo() or print "foo() failed\n"; + + +print 'Hello' . ' world'; +print "\n"; + +my $str = "hi"; +my $repeated_str = $str x 5; +println("$repeated_str"); + +println($repeated_str eq 'hihihihihi'); + +println($str ne 'hi'); + +$str =~ s/i/m/g; +println($str); + + +print 'A' .. 'Z', "\n"; +print 'a' .. 'z', "\n"; +print 'A' .. 'z', "\n"; +print 1 .. 20, "\n"; +print '&' .. '!', "\n"; +print 10 .. -10, "\n"; +print "$_\n" foreach 1 .. 10, "\n";