#!/usr/bin/perl -w use strict; #directory containing fpc map dirs my $fpcdir = '/home3/ftp/pub/gsc1/fpc_files'; #organism/fpc map dir names my @projects = ("mouse","human","cb","arab"); my %stats; #foreach of the fpc maps get total clones and contigs foreach(@projects) { &get_clones_and_contigs($fpcdir,$_); } sub get_clones_and_contigs($$) { my ($fpcdir,$project) = @_; # this is what I can not figure out - #this works on the first iteration # but fails to expand correctly the second time #&get_lones_and_contigs is called. open(FH,<$fpcdir/$project/*fpc>) || die "$! \n"; while() { if ($_ =~ /\sContigs\s.(\d+)\s.Clones\s.(\d+)\s/) { print "$project: contigs[$1] clones[$2] \n"; my @stats = ($1,$2); $stats{'project'} = \@stats; return; } } close FH; }