in reply to Strict to references of a particular Variable of particular type.
and the output#!/usr/bin/perl -w use strict; use Carp; use Data::Dumper; sub array_ref { my $array_ref = shift; croak 'Not an array reference' unless ref($array_ref) eq 'ARRAY'; print Dumper($array_ref); } my @array = qw/ 1 2 3 4 5 /; my %hash = qw/ 1 1 2 2 3 3 4 4 5 5 /; array_ref(\@array); array_ref(\%hash);
$VAR1 = [ '1', '2', '3', '4', '5' ]; Not an array reference at try.pl line 9 main::array_ref('HASH(0x81d4e14)') called at try.pl line 18
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strict to references of a particular Variable of particular type.
by Corion (Patriarch) on Dec 02, 2005 at 13:03 UTC | |
by Roger (Parson) on Dec 02, 2005 at 13:08 UTC |