1 #!/usr/bin/perl
 2 
 3 use strict;
 4 
 5 ContextNumeric( 5.5, 6 );
 6 ContextNumeric( '5.5', '6' );
 7 ContextNumeric( 'gibberish', '6' );
 8 ContextNumeric( '10gibberish', '6' );
 9 ContextNumeric( '10.1gibberish', '6' );
10 ContextNumeric( 'gib10berish', '6' );
11 ContextNumeric( 'gibberish10', '6' );
12 
13 print "\n";
14 
15 ContextString( 5.5, 6 );
16 ContextString( '5.5', '6' );
17 ContextString( 'gibberish', '6' );
18 ContextString( '10gibberish', '6' );
19 ContextString( '10.1gibberish', '6' );
20 ContextString( 'gib10berish', '6' );
21 ContextString( 'gibberish10', '6' );
22 
23 sub ContextNumeric {
24 	my ($x,$y) = @_;
25 
26 	my $result = $x + $y;
27 
28 	print "(NUMERIC) Adding '$x' to '$y' results in '$result'.\n";
29 }
30 
31 sub ContextString {
32 	my ($x,$y) = @_;
33 
34 	my $result = $x . $y;
35 
36 	print "(STRING) Concatenating '$x' and '$y' yields '$result'.\n";
37 }


syntax highlighted by Code2HTML, v. 0.9.1