in reply to subroutine arguments
Then, shift off the list within the function, like so:cog_class(\@c1_uniq_cog_ids, $name1);
So you finish up with something like:my $c1_uniq_cog_ids = shift; my $name = shift;
Update:#!/usr/bin/perl -w use strict; my $name1="chrom1 unique"; my @c1_uniq_cog_ids = qw(1 2 3 4 5); print "NAME1 $name1\n"; cog_class(\@c1_uniq_cog_ids, $name1); sub cog_class { my $c1_uniq_cog_ids = shift; my $name = shift; print "NAME $name\n"; for my $id ( @{$cog_ids_ref} ){ # BLAH BLAH } }
foreach my $id (@{c1_uniq_cog_ids}) { # Do stuff }
Update 2: Fixed, as pointed out by [id://cbrandtbuffalo]for (@{c1_uniq_cog_ids}) { # Do stuff }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: subroutine arguments
by cbrandtbuffalo (Deacon) on Oct 25, 2005 at 12:22 UTC | |
|
Re^2: subroutine arguments
by revdiablo (Prior) on Oct 25, 2005 at 14:11 UTC |