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

Discussion in 'Perl Misc' started by bbrelin@gmail.com, Jul 22, 2005.

  1. Guest

    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
    , Jul 22, 2005
    #1
    1. Advertising

  2. Guest

    wrote:
    > 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

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Jul 22, 2005
    #2
    1. Advertising

  3. <> wrote:


    > 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?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jul 23, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Georgy Pruss
    Replies:
    15
    Views:
    723
    Tim Roberts
    Dec 1, 2003
  2. Tim Peters
    Replies:
    1
    Views:
    356
    Duncan Booth
    Dec 1, 2003
  3. Sean Berry

    Question about glob.glob <--newbie

    Sean Berry, May 4, 2004, in forum: Python
    Replies:
    3
    Views:
    345
    David M. Cooke
    May 4, 2004
  4. Elbert Lev

    glob.glob unicode bug or feature

    Elbert Lev, Jul 31, 2004, in forum: Python
    Replies:
    5
    Views:
    392
    Neil Hodgson
    Aug 2, 2004
  5. Hitesh

    glob.glob output

    Hitesh, Mar 12, 2007, in forum: Python
    Replies:
    6
    Views:
    397
    Hitesh
    Mar 13, 2007
Loading...

Share This Page