#!/usr/bin/perl -w use strict; my %h; my @cols = qw( one two three four ); @h{@cols} = ( 1 .. 4 ); assign( \( @h{ @cols } ) ); print "$_ => $h{$_}\n" foreach @cols; sub assign { my $val = 0; foreach (@_) { $$_ = $val++; } }