Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mark Leighton Fisher (4252)

Mark Leighton Fisher
  (email not shown publicly)
http://mark-fisher.home.mindspring.com/

I am a Systems Engineer at Regenstrief Institute [regenstrief.org]. I also own Fisher's Creek Consulting [comcast.net].
Friday December 08, 2006
12:53 PM

Perl's Many Built-in Data Structures

[ #31854 ]

Perl has many data structures right at hand, which is a nice change from other languages. Not only do we have arrays and hashes built-in, but we have:

  • stacks - arrays with push+pop at one end;
  • queues - arrays with push at one end and pop at the other;
  • sets - hashes where you treat the value as a Boolean;
  • bags - hashes where the value is a number;
  • doubly-linked lists - arrays with pushes and pops at either end; and
  • regexes - first-class, built-in regular expressions (I often find myself writing wrapper classes for regexes in other languages, to try and duplicate Perl's simplicity and power.)

(And that's just what I can think of off the top of my head.) No wonder I haven't found a need to build my own low-level data structures in Perl. (Perl6 looks even nicer.)

This was prompted by Searching in .Net (don't search manually, let .Net do it for you) - level 100, which presents a similar kind of functionality for .NET that we've had with grep() since at least Perl4.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.