in reply to Re: Passing a hash byreference to a subroutine
in thread Passing a hash byreference to a subroutine

Hello karthiknix,

Sample of your code using strict and warnings as haukex correctly pointed out.

#!/usr/bin/perl use strict; use warnings; use Data::Dumper qw(Dumper); my @examples = ('perl', 'linux'); my $reference_of_example = \@examples; #referencing print Dumper your_sub($reference_of_example); # prints $VAR1 = 1; print Dumper my_sub($reference_of_example); print Dumper my_solution($reference_of_example); print Dumper haukex_solution($reference_of_example); sub your_sub { my $ref = @_; return $ref; } sub my_sub { return @_; } sub my_solution { my $ref = shift @_; return $ref; # or return shift @_; } sub haukex_solution { my ($ref) = @_; return $ref; } __END__ $ perl test.pl $VAR1 = 1; $VAR1 = [ 'perl', 'linux' ]; $VAR1 = [ 'perl', 'linux' ]; $VAR1 = [ 'perl', 'linux' ];

Update: Adding haukex solution.

Hope this helps.

Seeking for Perl wisdom...on the process of learning...not there...yet!