#!/usr/bin/perl

use Test::More tests => 3;

use strict;
use warnings;

use List;

is( first( sub { $_ == 3 }, ( 1 .. 5 ) ), 3, 'Matches a specific value' );
ok( !defined first( sub { $_ == 7 }, ( 1 .. 5 ) ), 'Returns undef if not found' );

is( first( qr/\D/, ( 1 .. 5, 'fred' ) ), 'fred', 'Matches by regex' );