Hi all monks, I have a problem. When reading all the perl docs on deleteing array elements they say somthing like this:
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;
}
... 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*...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.