rsFalse has asked for the wisdom of the Perl Monks concerning the following question:
OUTPUT:#!/usr/bin/perl use warnings; use strict; my @numbers = 6 .. 9; my @odd = ( 1, 5, 3 ); my @even = ( 4, 10 ); $\ = $/; $, = ' '; map { print( ( $_ % 2 ? @odd : @even ), "+$_" ) } @numbers; map { push( ( $_ % 2 ? @odd : @even ), "+$_" ) } @numbers;
How can I correctly push using "?:" operator?4 10 +6 1 5 3 +7 4 10 +8 1 5 3 +9 Not an ARRAY reference at ./push_fail.pl line 13.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: array push fails
by NetWallah (Canon) on Aug 14, 2017 at 18:26 UTC | |
|
Re: array push fails
by Cristoforo (Curate) on Aug 14, 2017 at 18:39 UTC | |
by rsFalse (Chaplain) on Aug 14, 2017 at 19:06 UTC | |
|
Re: array push fails
by Mr. Muskrat (Canon) on Aug 14, 2017 at 18:37 UTC |