though I've never used it, I am told that Data::Dumper does this...

check cpan if you don't have it

On Wed, 23 Jun 2004 13:29:44, Jaime Teng <[EMAIL PROTECTED]> wrote:

Hi,

I am trying to write a routine that would print out the value(s) of
the entire variable either it be scalar, hash or array:

########################################################
sub ShowValue {
        my $i = shift;
        my $v = shift;
        my $r = shift;
        
        if (ref($r) eq 'ARRAY') {
                print "array\n";
                for (my $x = 0; $x <= @$r; $x++) {
                        ShowValue($i+4, $v."[$x]", $r[$x]);
                }
        } elsif (ref($r) eq 'HASH') {
                $v = $v. '->' if $v;
                foreach my $key (keys %$r) {
                        ShowValue($i+4, $v.$key, $r{$key})
                }
        } else {
                print ' ' x $i, $v, ' : ', $r,"\n";
        }
}

my %args;
my @sequence;
$args{'returnHash'} = {};
$args{'dest_x'} = 'x';
$args{'dest_y'} = 'y';
unshift @sequence, \%args;
ShowValue (0,'',[EMAIL PROTECTED]);
########################################################

I could not seem to get this working properly. Can anyone help?
Is there any perl functions/modules that do just this?

thanks.
Jaime



Email Advisory==================================================
To ensure delivery of message to [EMAIL PROTECTED], please contact your email provider 
and ask them if your email server has a valid DNS entry. Public Email Servers must 
have a valid hostname and routeable public IP Address per RFC1912 compliance.

To test the compliance of your email server, please send an email to: [EMAIL 
PROTECTED]; our server will reply with a result within minutes.
==================================================Email Advisory

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to