#!/usr/bin/perl use Data::Dumper; simple_call( uniq1 => 1, uniq2 => 2, dup1 => 3, dup1 => 4 ); sub simple_call { my %hash = (); for ( my ($key, $value); $key = shift; ) { $value = shift; if ( dupAllow( $key ) ) { unless ( $hash{ $key } ) { my @tmp = (); $hash{ $key } = \@tmp; } my $aref = $hash{ $key }; push @$aref, $value; } else { $hash{ $key } = $value; } } print Dumper( \%hash ); # continue subroutine processing } sub dupAllow { my $key = shift; ( $key eq 'dup1' ) and return 1; ( $key eq 'dup2' ) and return 1; return 0; }