#!/usr/bin/perl -w use strict; # CASE 1: # use +0 to "delete leading zeros" # avoids having to use a printf %d format # or some kind of slow substitution statement # my $x = "00012"; print "$x\n"; #prints 00012 printf "%d\n",$x; #prints 12 $x+=0; #delete leading zeroes print "$x\n"; #prints 12 # CASE 2: # use '.' concatentation to # avoid having to use an # explict scalar() function # print "Number values= ", scalar(return_array()),"\n"; # prints 2 print "Number values= " .return_array(),"\n"; # prints 2 # CASE 3: # use !! to avoid using an "if" statement # my $y = "abx"; print $y ? 'T': 'F', "\n"; #prints T print $y ? 1 : 0, "\n"; #prints 1 print !!$y, "\n"; #prints 1 ??good idea?? print ''.is_input_valid(),"\n"; #prints 1 sub return_array { my @x = (12,23); return @x; } sub is_input_valid { my $f_validated_input =0; # more code here... $f_validated_input = 1; return $f_validated_input; }