in reply to Passing Empty/ Undefined values to a subroutine

To see what is actually being passed to my_sub, you may want to try using Data::Dumper to see what @_ actually contains.

#!/usr/bin/perl -w use Data::Dumper; use strict; my ($arg1,$arg2,$arg3) = qw(arg1 arg2 arg3); my $ret_val = my_sub($arg1, "", $arg2, "", "", $arg3); sub my_sub{ print Dumper(\@_); my $arg1 = shift; my $undef1 = shift; my $arg2 = shift; my $undef2 = shift; my $undef3 = shift; my $arg3 = shift; ....... and so on }

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1

Replies are listed 'Best First'.
Re: Re: Passing Empty/ Undefined values to a subroutine
by bobn (Chaplain) on Jun 22, 2003 at 15:46 UTC
    Update: oops responded to the wrong thing. sorry abvout that.

    Post code that runs and produces the results you see.

    Replacing the non-runnable

    ....... and so on

    with

    print "$arg1,$arg2,$arg3\n";

    produces output of:
    $VAR1 = [ 'arg1', '', 'arg2', '', '', 'arg3' ]; arg1,arg2,arg3


    which is the expected reesult. So what are you actuallydoing which doesn't work as expected?

    --Bob Niederman, http://bob-n.com