Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data Structures in PERL

0 views
Skip to first unread message

Roman Rodriguez

unread,
Sep 3, 2004, 7:28:05 AM9/3/04
to
Can you use PERL to create data structures such as linked list? if so, is
there maybe a link where this can be studied?

Thanks,
-RR


Tad McClellan

unread,
Sep 3, 2004, 8:11:51 AM9/3/04
to
Roman Rodriguez <rom...@cablespeed.com> wrote:

> Can you use PERL to create data structures such as linked list?


You are expected to check the Perl FAQ *before* posting to the
Perl newsgroup you know.

perldoc -q linked

How do I handle linked lists?


--
Tad McClellan SGML consulting
ta...@augustmail.com Perl programming
Fort Worth, Texas

Paul Lalli

unread,
Sep 3, 2004, 8:15:23 AM9/3/04
to
"Roman Rodriguez" <rom...@cablespeed.com> wrote in message
news:yridnWpGgaZ...@cablespeedwa.com...

> Can you use PERL to create data structures such as linked list? if
so, is
> there maybe a link where this can be studied?

(Perl. Not PERL. See: perldoc -q difference)

You *can*, but you don't want to. Perl's native arrays are already more
powerful than linked lists. This simple question smells like an XY
problem. You need to do X, and you've decided based on programming in
other languages that the way to do X is with a linked list (Y). So
you're asking us how to do Y intead of how to do X.

What is it you actually want to do?

To answer the question you (sort of) asked, a description of Perl
datastructures - hashes, arrays, arrays of array references, etc, are
discussed in:
perldoc perldsc

Paul Lalli


ctc...@hotmail.com

unread,
Sep 3, 2004, 10:25:13 AM9/3/04
to
"Roman Rodriguez" <rom...@cablespeed.com> wrote:
> Can you use PERL to create data structures such as linked list?

Yes, you can. But you rarely will want or need to.

> if so,
> is there maybe a link where this can be studied?

What is your goal? If you want to learn about linked lists, then
it probably isn't so relevant what language you use, so I'd just take
whatever language the tutorial you find happens to use. If your goal
is to learn perl, I'd choose something other than linked lists as the foil
for doing so. That said,
perldoc -q linked
should be enough to start you off exploring linked lists in Perl.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB

Abigail

unread,
Sep 3, 2004, 12:38:12 PM9/3/04
to
Roman Rodriguez (rom...@cablespeed.com) wrote on MMMMXXI September
MCMXCIII in <URL:news:yridnWpGgaZ...@cablespeedwa.com>:
)) Can you use PERL to create data structures such as linked list?

Yes.

)) if so, is
)) there maybe a link where this can be studied?

"man perlref".


But you have to ask yourself whether you really want a linked list.

Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'

Abigail

unread,
Sep 3, 2004, 12:39:48 PM9/3/04
to
Paul Lalli (mri...@gmail.com) wrote on MMMMXXI September MCMXCIII in
<URL:news:vfZZc.2291$ZS6.1737@trndny07>:
$$ "Roman Rodriguez" <rom...@cablespeed.com> wrote in message
$$ news:yridnWpGgaZ...@cablespeedwa.com...
$$ > Can you use PERL to create data structures such as linked list? if
$$ so, is
$$ > there maybe a link where this can be studied?
$$
$$ (Perl. Not PERL. See: perldoc -q difference)
$$
$$ You *can*, but you don't want to. Perl's native arrays are already more
$$ powerful than linked lists.

There are things you can do more efficiently with linked lists than
with Perl arrays.

Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'

Edward Wijaya

unread,
Sep 5, 2004, 2:04:08 AM9/5/04
to
On Fri, 3 Sep 2004 04:28:05 -0700, Roman Rodriguez <rom...@cablespeed.com>
wrote:


perldoc -q linked list

0 new messages