in reply to Re: Type of arg 1 to shift must be array (not sort)
in thread Type of arg 1 to shift must be array (not sort)
Yay for Perl!#!/usr/bin/perl use strict; use warnings; my @array = qw( a b c d e f ); # With sort.. my $sorted = shift( @{ [ sort( @array ) ] } ); # With grep my $grepped = shift( @{ [ grep{ /\w+/ } @array ] } ); # With map my $mapped = shift( @{ [ map{ $_ } @array ] } ); # As a stringified method call my $method = "@{ [ FooBar->new()->a_method() ] }"; print "$sorted\n$grepped\n$mapped\n$method\n"; package FooBar; use strict; use warnings; sub new { return bless {}, shift; } sub a_method{ return 'some string'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Type of arg 1 to shift must be array (not sort)
by merlyn (Sage) on Dec 16, 2005 at 01:00 UTC |