I don't understand why this happen

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default I don't understand why this happen

    open my $fh, "<", "items/list.db";
    print while (<$fh>);
    close $fh;

    This is suppose to printout the content in items/list.db ,
    but why I get somthing like "GLOB(0x162aca7)" ??

    Thanks in advise.

    Li Ngok Lam Guest

  2. Similar Questions and Discussions

    1. Why does this happen?
      :confused; Hi, I need a little help. I installed Adobe Shockwave to play a game on the internet. The game suggests that I use Internet explorer...
    2. what happen with msconfig???
      what happen with msconfig??? I can't found it???
    3. What happen when two client connect FCS at the same time
      In my mind, application.onConnect is the same as windows message queue. All the event and user define function in server application is only process...
    4. is freehand a class action waiting to happen?
      I wonder if there are as many ship-jumpers on the Adobe forums as there always seem to be on Macromedia's? I manage to get around in Freehand 10...
    5. What will happen to OpenServer...
      I was curious to see that SCO claimed a large company had purchased SCO licences for Linux installations. SCO refused to reveal the name but...
  3. #2

    Default Re: I don't understand why this happen

    On Monday, August 18, 2003, at 06:10 AM, Li Ngok Lam wrote:
    > open my $fh, "<", "items/list.db";
    I can't test it right this second, but I'm guessing it's the my() call
    inside of the open. Try this:

    my $fh;
    open $fh, '<', 'items/list.db' or die "File error: $!";
    print while $fh;
    close $fh;

    Hope that helps.

    James
    > print while (<$fh>);
    > close $fh;
    >
    > This is suppose to printout the content in items/list.db ,
    > but why I get somthing like "GLOB(0x162aca7)" ??
    >
    > Thanks in advise.
    James Edward Gray II Guest

  4. #3

    Default Re: I don't understand why this happen

    >
    > my $fh;
    > open $fh, '<', 'items/list.db' or die "File error: $!";
    It just the same as open my $fh =)
    > print while $fh;
    Hmm............. I guess this is not a 'read' argument

    Thanks in advise anyway =)

    Li Ngok Lam Guest

  5. #4

    Default Re: I don't understand why this happen

    On Monday, August 18, 2003, at 08:10 AM, Li Ngok Lam wrote:
    >>
    >> my $fh;
    >> open $fh, '<', 'items/list.db' or die "File error: $!";
    >
    > It just the same as open my $fh =)
    Save that it reads a little better, I think, and checks errors.
    >> print while $fh;
    >
    > Hmm............. I guess this is not a 'read' argument
    >
    > Thanks in advise anyway =)
    You're right, I meant:

    print while <$fh>;

    Sorry about that.

    James

    James Edward Gray II Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139