#!/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'; }