hi all
I don't think i totally understand hash references
I've made an array of linked stories, @linked_articles, and now I
want to split this list into two other arrays, one with stories that
have a 'print_only' checkbox checked, and the remainder into
@online_articles.
The problem is my new arrays are full of the actual story content -
not references to the original story which is what @linked_articles
contains. How did I loose my hash references? Should I use push in
this context or do I need to use map? Or am I just not passing my $_
variable incorrectly?
@linked_articles = map {$_->get_related_story } $story-
>get_elements('linked_article');
foreach (@linked_articles){
my ($po) = $_->get_elements('print_only');
if ($po && $po->get_value('1')){
push (@print_only_articles , %{$_}); # i previously tried
using just $_ to push onto the array
}else{
push (@online_articles , %{$_});
}
}
thanks very much,
Dawn
I don't think i totally understand hash references
I've made an array of linked stories, @linked_articles, and now I
want to split this list into two other arrays, one with stories that
have a 'print_only' checkbox checked, and the remainder into
@online_articles.
The problem is my new arrays are full of the actual story content -
not references to the original story which is what @linked_articles
contains. How did I loose my hash references? Should I use push in
this context or do I need to use map? Or am I just not passing my $_
variable incorrectly?
@linked_articles = map {$_->get_related_story } $story-
>get_elements('linked_article');
foreach (@linked_articles){
my ($po) = $_->get_elements('print_only');
if ($po && $po->get_value('1')){
push (@print_only_articles , %{$_}); # i previously tried
using just $_ to push onto the array
}else{
push (@online_articles , %{$_});
}
}
thanks very much,
Dawn