Why array always printed as pointer?

O

OttawaTrade

article ( [ MSGID|MSGNUM ], [FH] )
Retrieve the header, a blank line, then the body (text) of the specified
article.

If FH is specified then it is expected to be a valid filehandle and the
result will be printed to it, on sucess a true value will be returned. If FH
is not specified then the return value, on sucess, will be a reference to an
array containg the article requested, each entry in the array will contain
one line of the article.

If no arguments are passed then the current article in the currently
selected newsgroup is fetched.

MSGNUM is a numeric id of an article in the current newsgroup, and will
change the current article pointer. MSGID is the message id of an article as
shown in that article's header. It is anticipated that the client will
obtain the MSGID from a list provided by the newnews command, from
references contained within another article, or from the message-id provided
in the response to some other commands.

If there is an error then undef will be returned.



I did this
print $nntp-> article ('<[email protected]>');

output:
ARRAY(0x1d3ffac)

I want to print and do regex on the output. Is there a to_string, _print
option on an array?

I think pring $array will work, but not in my case. I can not find why.
 
P

Paul Lalli

OttawaTrade said:
Subject: Why array always printed as pointer?

No such things. Perhaps you're thinking of another language.
article ( [ MSGID|MSGNUM ], [FH] )
If FH is not specified then the return value, on sucess, will be a reference to an
array

Which part of that statement is confusing to you? The return value is
not an array, but a reference to an array.
I did this
print $nntp-> article ('<[email protected]>');

output:
ARRAY(0x1d3ffac)

Right. That's the reference to an array that article() is documented
to return. Why were you expecting anything else?
I want to print and do regex on the output. Is there a to_string, _print
option on an array?

Again, what language are you thinking of?

You should read up on references to learn how to dereference them:

perldoc perlreftut
perldoc perllol
perldoc perldsc
perldoc perlref
I think pring $array will work, but not in my case.

What makes you think that would work?
I can not find why.

Because, as a wise man once said, "You can't just make shit up and
expect it to work." Programming is not a guessing game. All of these
features are very well documented. Go. Read the documentation.
Learn.

Paul Lalli
 
P

Paul Lalli

OttawaTrade said:
I guess it is a deref issue.
I did two things. 1 works, 2 does not

1 $lines= $nntp-> article ('<[email protected]>');
print @$lines;

2 print @($nntp-> article ('<[email protected]>'));

See my previous response. "You cannot just make shit up and expect it
to work!"
Is there a way to get rid of the middleman $lines?

Yes. By reading the documentation I pointed you at to begin with.
Stop guessing. Go learn.

Paul Lalli
 
O

OttawaTrade

See my previous response. "You cannot just make shit up and expect it
to work!"


Yes. By reading the documentation I pointed you at to begin with.
Stop guessing. Go learn.

Paul Lalli

What is your problem? Do you need me to call 911 for you?
 
E

Eric J. Roode

I guess it is a deref issue.
I did two things. 1 works, 2 does not

1 $lines= $nntp-> article ('<[email protected]>');
print @$lines;

2 print @($nntp-> article ('<[email protected]>'));

I do not believe you.
Is there a way to get rid of the middleman $lines?

I have no clue what this question is asking.

--
Eric
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`
 
E

Eric J. Roode

What is your problem? Do you need me to call 911 for you?

His "problem" is that you appear to be programming at random, simply trying
various syntax combinations until you get one that looks like maybe it give
the answer that you expect. This is not programming. This is guessing.

All of your questions so far have been along the lines of "tell me how to
do it" not "help me to understand it." Show some respect.

--
Eric
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top