Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Guys: I havnt coded in perl for a while, so forgive my rustyness. Im writing a quick and dirty snippet that logs into a POP3 server, and retreives the header of the last message in the box. Now, I got the number of the last message, but when I try to get the head, it returns a reference to an array. eg.
sub pop_header { @popst = $pop->popstat(); $popnum = $popst[0]; print "Header of message $popnum being retreived.\n"; @array = $pop->top($popnum); print "@array\n"; }
This give the following output.
Header of message 23 being retreived. ARRAY(0x2cbf0)
How do I get the actual header rather than this reference. I know this is probably obvious... -Chris

Replies are listed 'Best First'.
Re: POP3 in libnet
by BazB (Priest) on Jan 25, 2002 at 03:39 UTC

    Update: I initally put the following code, but I suspect I'm wrong. I've confused myself again...

    $msg = $pop->top($popnum); print $msg;

    Update. Working code (excuse the altered variable names) is:

    my $head = $pop->top($popnum); print @{$head};

    Or, you can even do:
    print @{$pop->top($popnum)};