http://www.perlmonks.org?node_id=1218801


in reply to About personal function

Hello dideod.yang,

Your script is not valid perl syntax. I recommend that you take a closer look at some documentation in order to become more familiar with perl syntax and debugging.

Here is a modified version of your script that will print the first element of @x, which is 'A'. It will also print all the elements of @x (joined by commas).

#!/usr/bin/env perl use strict; use warnings; my @x = ( 'A', 'B', 'C'); my @y = ( 'C', 'D', 'F'); test(\@x,\@y); sub test{ my ($x, $y) = @_; print "First element of x is: ", $x->[0], "\n"; print "All elements of x are: ", join(', ', @{$x}), "\n"; }