sub fill_list { my ($mask, $file) = @_; # somewhat more efficient than two shifts open (LIST, '>', $file) or die "Couldn't open $file: $!"; for (glob($mask)){ print LIST "$_\n"; } close LIST; } #### print LIST map("$_\n", glob($mask)); #### 2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$