in reply to Dynamically Linked List
Untested, but that's generally one way to do it.my $tail; for (1 .. 10) { my %record = ( title => (1950 + $_), artist => 'chromatic orchestra', ); # handle first condition $tail ||= $record; $tail->{_prev} = \%record; $record{_next} = $tail; $tail = \%record; }
Update: Fastolfe pointed out that since I had changed my mind in the middle about the nature of %record, I should have changed the curly braces to parens. Fixed.
|
|---|