How do I access the contents of a glob???

B

bbrelin

Hello,

If I have a function like

foo ($myvar) {
}

and...

ref($myvar) = "GLOB"

How do I view the contents of $myvar?

I've tried doing a print *$myvar I get something like:

*GLOB(0xb464bc8)

I want to print the actual data contained in the glob. How do I do
that?

Thanks,

Braun Brelin
 
X

xhoster

Hello,

If I have a function like

foo ($myvar) {
}

and...

ref($myvar) = "GLOB"

How do I view the contents of $myvar?

I've tried doing a print *$myvar I get something like:

*GLOB(0xb464bc8)

I want to print the actual data contained in the glob. How do I do
that?

Data::Dumper.

Xho
 
T

Tad McClellan

If I have a function like

foo ($myvar) {
}


Then you do not have a function written in the Perl programming language.

Did you mean a function definition:

sub foo { }
or
sub foo ($) { } # with prototype

Or did you mean a function call:

foo ($myvar);

??

ref($myvar) = "GLOB"


ref() is not an lvalue subroutine, so that is not in Perl either.

Did you mean:

ref($myvar) eq "GLOB"

??

How do I view the contents of $myvar?


Post real Perl if you'd like real help.

I've tried doing a print *$myvar I get something like:

*GLOB(0xb464bc8)

I want to print the actual data contained in the glob.


A glob contains a scalar and an array and a hash and ...

Do you want to print the scalar data, or the array data,
or the hash data...?

How do I do
that?


We do not know what code you are using.

We do not even know what, exactly, it is that you want to accomplish.

We are going to get nowhere without some useful information.

Post a short and complete program *that we can run* that illustrates
your problem, and we can probably help to solve your problem.

Have you seen the Posting Guidelines that are posted here frequently?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top