#!/usr/bin/perl use Data::Dumper; sub get_day_name { return "first" if $_[0] =~ /one/; return "second" if $_[0] =~ /two/; return "third" if $_[0] =~ /three/; return; } print Dumper {map {$_ => get_day_name($_)} }; __DATA__ one two three