#!/usr/local/bin/perl -w use strict; print "[", scalar test('abc'), "]\n"; print "[", test('abc'), "]\n"; print "[", scalar test('123'), "]\n"; print "[", test('123'), "]\n"; sub test { my @rv = $_[0] =~ /^([0-9]+)$/; return @rv[ 0 .. $#rv ]; }