[ create a new paste ] login | about

Link: http://codepad.org/r2bGKlAA    [ raw code | output | fork ]

Perl, pasted on Nov 24:
1
2
3
4
5
6
7
8
9
10
11
printf "Perl version is v%vd\n\n", $^V; # Codepad's Perl version is old (2002)

use List::Util 'first';

my @list = (11, 22, 33);

my $x = 22;
print "list contains $x\n" if first {$_ eq $x} @list;

my $x = 44;
print "list contains $x\n" if first {$_ eq $x} @list;


Output:
1
2
3
Perl version is v5.8.0

list contains 22


Create a new paste based on this one


Comments: