kurreburre has asked for the wisdom of the Perl Monks concerning the following question:
... mening I send in an array reference into the man_cfs function. But when I do the deletion nothing happens with $cashflow However @cashflow gets the element deleted... Why is this?? If I send in a referens shouldn't it be possible to delete the element using the techniques in the books, and why is the @cashflow populated?? Would be most grateful for answers, cause I have a deadline tomorrow *YNF*...my @arr = (1, 2, 3); delete $arr[0]; however I have set of functions looking like this ### main ### fetch the cashflows from input file and map the values from the co +nfig file my @cfs = &fetch_cfs; ### manipulate the cashflow values @cfs = &man_cfs(\@cfs,\@valid_ports); ######################################## sub man_cfs { my ($cashflow,$valid_ports) = @_; foreach my $cf (@$cashflow) { if ($cf->{'portfolio_id'} eq "") { delete $cashflow[$count]; next; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: deleteing array elements I get mad!!
by davorg (Chancellor) on Oct 03, 2006 at 08:36 UTC | |
by kurreburre (Acolyte) on Oct 03, 2006 at 12:20 UTC | |
by grep (Monsignor) on Oct 03, 2006 at 18:53 UTC | |
|
Re: deleteing array elements I get mad!!
by rminner (Chaplain) on Oct 03, 2006 at 08:06 UTC | |
|
Re: deleteing array elements I get mad!!
by Fletch (Bishop) on Oct 03, 2006 at 12:08 UTC | |
|
Re: deleteing array elements I get mad!!
by Jenda (Abbot) on Oct 03, 2006 at 13:22 UTC | |
|
Re: deleteing array elements I get mad!!
by Tanktalus (Canon) on Oct 03, 2006 at 13:58 UTC |