Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Elements of Programming with Perl

Posted by Hemos on Mon Jan 31, 2000 12:02 PM
from the bringing-competition-to-the-mix dept.
Bringing a little competition to O'Reilly, this Manning Publications book Elements of Programming with Perl seems to be have struck a nerve with reviewer chromatic. Click below to find out how - and possibly add a new book to your library.
Elements of Programming with Perl
author Andrew L. Johnson
pages 352
publisher Manning Publications, 09/1999
rating 8/10
reviewer chromatic
ISBN 1884777805
summary New to programming, and think Perl may be up your alley? Andrew Johnson's excellent Elements of Programming with Perl will teach you both disciplines.

What's the Purpose?

Hundreds of books teach programming. Dozens of good books teach Perl. Where's a book for someone who wants to learn Perl and programming, at the same time? Thankfully, that's just what Elements of Programming with Perl does.

What's Good?

From the start, Johnson's explanations are clean and clear. It's obvious that he's polished his didactic style through years of real world teaching. Also from the start, good programming practices receive due emphasis. Though it's not specifically mentioned until chapter 9, Johnson advocates and demonstrates good program design through a mixture of Donald Knuth's Literate Programming and his own code tangling style (mingling documentation, design notes, and code in a single source file, similar to POD on steroids).

The teaching flow is logical and consistent, with chapters dividing the material into logical divisions. By the end of chapter flow, students should be capable of writing moderately complex programs. Subsequent chapters build on that foundation, and most provide a specific example program to tie things together. These programs all have a practical concentration.

On the Perl-specific side, Johnson does not shy away from recommending the copious Perl documentation, CPAN, other books like the Camel, and many other excellent resources. Much of the value of an education is learning where to go for further information.

What's not Great?

Some of Johnson's focus is on mathematical applications, which may distract some readers. Also, this book may not serve as a future reference after you've become more comfortable with the language. Look to the Camel or Perl in a Nutshell for that -- Johnson concentrates on teaching the basics rather than documenting the iotas and tittles of internal Perl functions.

Finally, the example program in Chapter 19 may be hairy for novice programmers. Sit down in a very quiet room with a pad of note-paper and your beverage of choice. Consider it a final exam after you're familiar with everything preceding it.

Summary

This is a good introduction to Perl, and a very good introduction to programming in general. Johnson promotes good habits and discipline. Elements may not sit on your shelf as a reference, but it will help you to become an effective programmer. It's a rare book that teaches as well as it informs, so take the plunge and teach yourself Perl and programming.

Pick this book up at ThinkGeek.

Table of Contents

  • preface
  • acknowledgments
  1. Introductory elements
    1. Introduction
    2. Writing code
    3. Writing programs
  2. Essential elements
    1. Data: types and variables
    2. Control structures
    3. Simple I/O and text processing
    4. Functions
    5. References and aggregate datastructures
    6. Documentation
  3. Practical elements
    1. Regular expressions
    2. Working with text
    3. Working with lists
    4. More I/O
    5. Using modules
    6. Debugging
  4. Advanced elements
    1. Modular programming
    2. Algorithms and data structuring
    3. Object-oriented programming and abstract data structures
    4. More OOP examples
    5. What's left?
  • appendix A Command line switches
  • appendix B Special variables
  • appendix C Additional resources
  • appendix D Numeric formats
  • glossary
  • index
This discussion has been archived. No new comments can be posted.
Elements of Programming with Perl | Log In/Create an Account | Top | 194 comments (Spill at 50!) | Index Only | Search Discussion
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1) | 2
  • Re:Linux? by ilduce (Score:1) Monday January 31 2000, @07:13AM
  • This fills a void (Score:5)

    by predictive (108569) on Monday January 31 2000, @07:15AM (#1317920)

    Putting aside the (flamebait) arguments that Perl is or is not a good first language, I've seen several people turn to other languages that were less appropriate for their needs (like sysadmins) because of the lack of a good beginner book for Perl

    Until now, it's been relatively easy to find books on C, C++, Java, etc for the non-programmer, but Perl has historically been supported by tomes that double as reference manuals, which are not really the best for first-time language instruction

    Even the excellent Llama book (Learning Perl) assumes some familiarity with the use of logic and simple programming concepts (like variables). This makes it doubly difficult for a newcomer who wants to harness the text-processing power of Perl but quickly becomes lost in its (admittedly unique) syntax.

    I'm glad to see a better entry point to perl for the programming newbie. Maybe now the c.l.p.m. s/n ratio will improve

  • usefullness of perl limited. by Anonymous Coward (Score:1) Monday January 31 2000, @07:29AM
  • by Matts (1628) on Monday January 31 2000, @07:32AM (#1317925) Homepage
    That's fine if you know programming already. I can just picture an English lit graduate trying to learn programming from slash 0.9.1... hahahah :)

    And besides that - theres an awful lot of crud code in the open source world (as there is in the closed source world - but you can't download and learn from that) and I'd hate to see someone learn object oriented techniques from that rather than a good book on the subject.
  • My two cents by Anonynous Coward (Score:1) Monday January 31 2000, @07:33AM
  • Python? by DQuinn (Score:2) Monday January 31 2000, @07:38AM
  • Re:Python? (Score:3)

    by gorilla (36491) on Monday January 31 2000, @07:44AM (#1317928)
    The biggest problem I have with python is the syntaxly signifiant indention.

    If you post a perl program on /., it works. If you post a python program on /., it fails.

    Indentation is important for readability, I'd consider a program badly written if it didn't have correct indentatation, but to to make it syntaxly significant is a mistake.

  • Re:Problem with O'Reilly books by DQuinn (Score:2) Monday January 31 2000, @07:53AM
  • by quakeaddict (94195) on Monday January 31 2000, @07:55AM (#1317931)
    before I start, I would like to thank the reviewer for their time in posting their comments.

    IMHO......

    From a non system-admin point of view...Perl as a first language is scary.

    Thats not to say Perl isn't useful or good, but I would not want to learn about programming by learning Perl as my first language. It has way to many oddities that, if you are interested in programming, don't make the conceptual leap, as it were, to other languages.

    For example, in Perl (like most scripting languages) there is a single data type to represent everything from strings to characters to all sorts of numbers. Java/C++/C/Fortran/Basic etc...have different data types (short, long, char, String etc...) for very good reasons.

    Having someone learn programming via Perl then have them get "more specific" is harder than going in the reverse direction. I can just imagine all these questions from students..."What do you mean there are specific types of variables? "What is strongly typed?" etc....

    Perl also suffers from a syntax problem. Perl has chosen highly compact notation that can scare even the mosty hardy Perl programmer.

    I say learn another language so you can see how Perl has generalized the problem space, not the reverse.

    With these things in mind, I think the usefullness of this book is not as high as one might think.
  • Confessions of a recent Perl convert by kd5biv (Score:1) Monday January 31 2000, @08:03AM
  • Because HTML has nothing to do with password auth by Photon Ghoul (Score:1) Monday January 31 2000, @08:12AM
  • Fills void but not completely... by NatePWIII (Score:1) Monday January 31 2000, @08:13AM
  • Re:Python? by INT 21h (Score:2) Monday January 31 2000, @08:17AM
  • Re:Then what language? by leitchn (Score:1) Monday January 31 2000, @08:21AM
  • Re:Perl as A First Language Is Scary by GnrcMan (Score:2) Monday January 31 2000, @08:23AM
  • Offtopic, skip this... by Remote (Score:1) Monday January 31 2000, @08:34AM
  • Re:Python? by DQuinn (Score:1) Monday January 31 2000, @08:34AM
  • Don't disagree by crush (Score:1) Monday January 31 2000, @08:38AM
  • Re:Then what language? by crush (Score:1) Monday January 31 2000, @08:44AM
  • Re:Then what language? by GnrcMan (Score:2) Monday January 31 2000, @08:44AM
  • Re:Linux? by Zico (Score:1) Monday January 31 2000, @08:46AM
  • Justification. by crush (Score:1) Monday January 31 2000, @08:48AM
  • perl-as-language? by indrani (Score:1) Monday January 31 2000, @08:49AM
  • Offtopic - Re:Confessions of a recent Perl convert by dillon_rinker (Score:2) Monday January 31 2000, @08:54AM
  • It's because Larry's soooo cool! by fishlet (Score:1) Monday January 31 2000, @08:55AM
  • Re:Problem with O'Reilly books by vectro (Score:1) Monday January 31 2000, @08:57AM
  • Python books by andy@petdance.com (Score:1) Monday January 31 2000, @08:58AM
  • Re:Fills void but not completely... by (Score: 6) (Score:1) Monday January 31 2000, @08:59AM
  • by Matts (1628) on Monday January 31 2000, @09:03AM (#1317963) Homepage
    Before you dismiss Perl altogether as a friendly robust large scale programming language, I seriously recommend a read of Object Oriented Perl by Damian Conway. It's a truly awsome book which just brings together clean programming and perl. Something a lot of people didn't think was possible!

    After reading it I built XML::XPath - an implementation of the XPath spec in perl. It uses lots of classes to do its work, and I feel it's coded very cleanly. And it remains pretty quick (Damian has a discussion of Perl's OO speed issues in the book). If you want to check it out see CPAN. If you don't or can't understand the code I feel I've done something really wrong.
  • Re:Problem with O'Reilly books by slickwillie (Score:1) Monday January 31 2000, @09:03AM
  • cheaper than thinkgeek by joefission (Score:2) Monday January 31 2000, @09:04AM
  • Re:Python? (Score:3)

    by Zico (14255) on Monday January 31 2000, @09:12AM (#1317967)

    Can't say I was exactly thrilled with Programming Python. I came into Python already knowing Perl, and just didn't really get anywhere with Programming Python. The continuity just seemed all wrong, out of order, etc. So, I didn't do anything with Python for a couple of years.

    On a whim (meaning one of those times when you're walking around a bookstore with a wad of cash burning a hole in your pocket), I decided to pick up Learning Python. Man, am I glad I did. Yeah, there's a lot of really basic programming stuff in there (which makes it an excellent book for complete newbies), but I found it to be a much better introduction to the Python way of doing things, possibly because it was such a fast read. Once I got the basics down, exploring the more advanced stuff just from the online and included docs was a breeze.

    Stick with giving Python a try, though. You say you know OOP, but if your knowledge comes from using Perl, I think you'll be happy just how easy OOP is with Python in comparison. I like it enough that it's replaced Perl for me as my favorite quick-n-dirty language -- it just "feels" more correct when I'm using it. And yes, I know the degree to which Perl is a "write-only" language depends on the particular programmer, but it's been my experience every single time that when I've had to work with other people's code, the Python stuff was always easier to jump right into than the Perl stuff.

    Anyway, that's just my opinion -- what prompted me to write was that I just purchased "Python and Tkinter Programming" from Manning Publication's website, then came to Slashdot to see a book review featuring a book from the same company. I've never read any of their books before, so am kind of curious.

    Cheers,
    ZicoKnows@hotmail.com

  • indenting by MattMann (Score:1) Monday January 31 2000, @09:13AM
  • Re:This fills a void but does it cover by pipeb0mb (Score:1) Monday January 31 2000, @09:15AM
  • by twit (60210) on Monday January 31 2000, @09:18AM (#1317970) Homepage
    That argument doesn't merely apply to books; it applies to all facets of education. If the knowledge is out there, why don't we liberate ourselves to seek it rather than being directed by some obscure authority figure?

    The fact is that this doesn't work. The act of seeking relevant information alone gradually takes more time than absorbing the information itself (as any graduate student can tell you). An instructor, whether at the podium of a lecture hall or at the typewriter, putting together a book, does the initial search for you.

    If your time is worth nothing (and some people's time is worth nothing), then you can spend time working through library catalogues and search engine results. You can gain sufficient experience and knowledge to figure out a subject on your own, but it takes time. Most people, including myself, don't have that luxury; we could all reinvent the wheel, too, but why?

    --
  • Re:Books can be over rated by warpeightbot (Score:2) Monday January 31 2000, @09:24AM
  • Tom C.? Is that you? by drivers (Score:1) Monday January 31 2000, @09:24AM
  • Re:Justification. by qbwiz (Score:1) Monday January 31 2000, @09:26AM
  • Re:SLASH moving to Python by joefission (Score:1) Monday January 31 2000, @09:32AM
  • Re:Then what language? by Foaf (Score:2) Monday January 31 2000, @09:34AM
  • Re:Perl as A First Language Is Scary by Cy Burdock (Score:2) Monday January 31 2000, @09:48AM
  • Re:This fills a void by nickm (Score:1) Monday January 31 2000, @09:51AM
  • Re:Python books by nickm (Score:1) Monday January 31 2000, @09:57AM
  • Re:Then what language? by Anonymous Coward (Score:1) Monday January 31 2000, @09:59AM
  • Maybe you should look at the table of contents by jslag (Score:1) Monday January 31 2000, @09:59AM
  • Re:Python books by Anonymous Coward (Score:1) Monday January 31 2000, @10:02AM
  • Handspring + ISilo + Perl CDROM Bookshelf by deusx (Score:2) Monday January 31 2000, @10:04AM
  • Re:Tom Christensen is a fucking asshole. by nickm (Score:1) Monday January 31 2000, @10:04AM
  • by King Babar (19862) on Monday January 31 2000, @10:09AM (#1317993) Homepage
    For example, in Perl (like most scripting languages) there is a single data type to represent everything from strings to characters to all sorts of numbers.

    There are many reasons why Perl may or may not be a good first language, but this can't be one of them, since it just isn't true. TCL used to be the textbook example of a language that used the string as its representation for everything, but TCL isn't string only anymore, either.

    Really, I don't know where people get this idea about Perl, which certainly isn't the most typeful language on the block, but is hardly short of interesting types. I suppose it comes from the fact that Perl does provide a lot of automagical operators and conversions (although the fact that conversions are involved should make it clear that Perl has more than one underlying type).

    But one thing I'd like to point out in particular:

    Java/C++/C/Fortran/Basic etc...have different data types (short, long, char, String etc...) for very good reasons.

    Says somebody who clearly hasn't ever had to justify the difference between a short and long to a beginning (or non-)programmer. I would actually argue that the short/long difference is exactly the kind of "people working for the computer" stuff that doesn't belong anywhere near somebody's first exposure to programming.

    If you want to teach the importance of types at the same time you teach programming, you would do better to use a language that has a more interesting and flexible type system; one obvious candidate would be Haskell, or it's interpreted cousin Hugs [haskell.org].

  • Re:Perl by inah (Score:1) Monday January 31 2000, @10:20AM
  • Re:Fills void but not completely... by gnarphlager (Score:1) Monday January 31 2000, @10:22AM
  • Re:Then what language? by graybeard (Score:2) Monday January 31 2000, @10:26AM
  • Re:Python books by Zorikin (Score:1) Monday January 31 2000, @10:40AM
  • The last language by rellort (Score:2) Monday January 31 2000, @10:46AM
  • Re:Then what language? by Zorikin (Score:1) Monday January 31 2000, @11:14AM
  • What should a learner's language be like? by rgmoore (Score:2) Monday January 31 2000, @11:20AM
  • by hey! (33014) on Monday January 31 2000, @11:53AM (#1318011) Homepage Journal
    The best thing about C is that almost anybody with any sense teaching or learning C uses K&R. Beginners consciously or unconsciously absorb a standard style and approach to common programming problems that are within the purview of the language.

    What's the worst thing about Perl? The biggest complaint I hear is that Perl is cryptic; however I think this is bit of a bum rap. It isn't hard to make C programs that rival the worst Perl examples. Also, I've found some largish Perl systems that were a breeze to maintain, very clear and well organized.

    I think a lot of this complaint really can be traced to the Camel book, which while generally admirable and clear in its explanations is a bit too hung up on the Perl motto: "There's more than one way to do it". It is an interesting, and perhaps essential element of the Perl philosophy (I haven't decided which), but unfortunately every new Perl programmer who uses the Camel book to learn makes up his own idioms, and they don't always choose well.

    I'd be interested in the consistency and quality of the Perl style in the book. It may be time for an "elements of Perl style" handbook.


  • Re:Python? by Richard Jones (Score:2) Monday January 31 2000, @11:53AM
  • Re:Then what language? by GnrcMan (Score:2) Monday January 31 2000, @11:54AM
  • Re:The last language by vyesue (Score:2) Monday January 31 2000, @11:55AM
  • You are the ... by Camel Pilot (Score:1) Monday January 31 2000, @12:03PM
  • Re:Fine way to waste your time by JackiePatti (Score:1) Monday January 31 2000, @12:10PM
  • Insightful (Score:3)

    by GnrcMan (53534) on Monday January 31 2000, @12:12PM (#1318019) Homepage
    Perl zealots sound exactly like VB zealots, and for the same reasons: It's a blunt instrument. It looks "powerful" to them,
    but that's because they just don't get it.


    That is a very insightful statement(ignoring the surrounding flamebait). Gung-ho Perl programmers do have the same mentality and viewpoint as VB programmers.
    But the reason Perl is so quick is the same reason that VB is so quick. They both let you get away with almost anything. While this is fine for small scripting solutions, it breaks down as your application becomes more complex.
    Perl is useful, but only for small scripting problems. As your problem grows, Perl becomes less and less useful and no amount of burying your head in the sand will change that.

    One of the most important and valuable skills a developer can have is knowing what tools to use for what job. I use Perl to bang out a simple script in a day or two. For anything more complicated I use C or C++.

    --GnrcMan--
  • Re:Useless like a fox... by kulturkritik (Score:1) Monday January 31 2000, @12:20PM
  • re: abstraction by kulturkritik (Score:1) Monday January 31 2000, @12:25PM
  • Make's syntax is dumb by baxissimo (Score:1) Monday January 31 2000, @12:29PM
  • Re:Then what language? by GnrcMan (Score:2) Monday January 31 2000, @12:32PM
  • Re:The last language by rellort (Score:2) Monday January 31 2000, @12:34PM
  • offtopic: which is better? by kulturkritik (Score:1) Monday January 31 2000, @12:37PM
  • Re:Object Oriented Perl by GnrcMan (Score:2) Monday January 31 2000, @12:52PM
  • Website 'Stalker'...All Please Comment by Anonymous Coward (Score:1) Monday January 31 2000, @12:53PM
  • Re:offtopic: which is better? by GnrcMan (Score:1) Monday January 31 2000, @12:57PM
  • Re:It's because Larry's soooo cool! by Captain Teflon (Score:1) Monday January 31 2000, @01:14PM
  • Re:Then what language? by GnrcMan (Score:1) Monday January 31 2000, @01:14PM
  • Re:The last language by eric.t.f.bat (Score:2) Monday January 31 2000, @01:19PM
  • Re:Object Oriented Perl by eric.t.f.bat (Score:1) Monday January 31 2000, @01:27PM
  • Re:Then what language? by platypus (Score:1) Monday January 31 2000, @01:29PM
  • Re:Perl does NOT have just one datatype by GnrcMan (Score:1) Monday January 31 2000, @01:35PM
  • Re:You are the ... by Camel Pilot (Score:1) Monday January 31 2000, @01:41PM
  • mais oui (Re:Can you back that up?) by inah (Score:1) Monday January 31 2000, @01:42PM
  • Re:Can you back that up? by hotfries (Score:1) Monday January 31 2000, @01:44PM
  • perl and the x86, the ugly evolution of a silicone by maraist (Score:2) Monday January 31 2000, @01:49PM
  • Re:Object Oriented Perl by VirtualAdept (Score:1) Monday January 31 2000, @02:14PM
  • Re:Insightful by MrDarkguy (Score:1) Monday January 31 2000, @02:32PM
  • Re:The last language by the eric conspiracy (Score:1) Monday January 31 2000, @02:42PM
  • Tips for perl as a first language... by perigeeV (Score:1) Monday January 31 2000, @02:51PM
  • Hey Morons by pudge (Score:1) Monday January 31 2000, @02:58PM
  • Re:Perl as A First Language Is Scary by Anonymous Coward (Score:1) Monday January 31 2000, @03:33PM
  • Re:Object Oriented Perl by andy@petdance.com (Score:1) Monday January 31 2000, @03:39PM
  • Re:Insightful by GnrcMan (Score:1) Monday January 31 2000, @03:42PM
  • Re:None of that makes your programs OO by eric.t.f.bat (Score:1) Monday January 31 2000, @03:43PM
  • Re:Fine way to waste your time by twit (Score:2) Monday January 31 2000, @03:56PM
  • Partial towards oreilly by befan (Score:1) Monday January 31 2000, @04:05PM
  • Re:Perl as A First Language Is Scary by Cy Burdock (Score:1) Monday January 31 2000, @04:20PM
  • Re:This fills a void by jon_c (Score:1) Monday January 31 2000, @04:56PM
  • Re:The last language by quonsar (Score:2) Monday January 31 2000, @05:23PM
  • Re:Can I use Perl to... by Hallow (Score:1) Monday January 31 2000, @05:27PM
  • Re:The last language by MycoMan (Score:1) Monday January 31 2000, @06:14PM
  • about that CD... :-P by pedro (Score:1) Monday January 31 2000, @06:34PM
  • Re:Oops, I goofed by kulturkritik (Score:1) Monday January 31 2000, @06:45PM
  • Re:Then what language? by Gid1 (Score:1) Tuesday February 01 2000, @12:38AM
  • Re:The last language by Panelvan (Score:1) Tuesday February 01 2000, @12:38AM
  • Programming has many levels - do you do assembly? by witty1 (Score:1) Tuesday February 01 2000, @01:05AM
  • Re:This fills a void by StMaybe (Score:1) Tuesday February 01 2000, @02:22AM
  • Re:Website 'Stalker'...All Please Comment by kuro5hin (Score:2) Tuesday February 01 2000, @02:50AM
  • Re:Object Oriented Perl by merlyn (Score:1) Tuesday February 01 2000, @03:06AM
  • Re:Then what language? by JonesBoy (Score:1) Tuesday February 01 2000, @03:53AM
  • Re:Perl as A First Language Is Scary by Arien (Score:1) Tuesday February 01 2000, @03:55AM
  • Re:Books can be over rated by AngusSF (Score:1) Tuesday February 01 2000, @05:14AM
  • Re:Perl does NOT have just one datatype by mikemulvaney (Score:1) Tuesday February 01 2000, @05:27AM
  • Smalltalk as first language by Stu Charlton (Score:1) Tuesday February 01 2000, @07:50AM
  • Smalltalk. by Stu Charlton (Score:1) Tuesday February 01 2000, @07:57AM
  • Re:Website 'Stalker'...All Please Comment by Abigail-II (Score:2) Tuesday February 01 2000, @08:10AM
  • by Abigail-II (20195) on Tuesday February 01 2000, @08:16AM (#1318091) Homepage
    But you'll get to know that "school" and life will be good.

    Of course, the -d in Perl comes from a certain "school" as well. The test function from Unix shells.

    For a experienced perl programmer at the end of the day he/she will use what's more convenient, which is good. But for someone who's learning the ropes it can be exasperating.

    And this is different from learning the libraries in C (or Python) in which way?

    -- Abigail

  • Re:Perl as A First Language Is Scary by Abigail-II (Score:2) Tuesday February 01 2000, @08:30AM
  • Re:Perl as A First Language Is Scary by Abigail-II (Score:2) Tuesday February 01 2000, @08:35AM
  • by Abigail-II (20195) on Tuesday February 01 2000, @08:41AM (#1318094) Homepage
    But it does matter, because there are diferent comparison operators: ==(numbers) and eq(strings)

    No, it doesn't. == and eq are different operators, doing different things. They aren't the same operator giving different answers depending on the type of the operands, like / does in C. == and eq are different, just like + and * are.

    -- Abigail

  • Re:Problem with O'Reilly books by diskokaiser (Score:1) Tuesday February 01 2000, @09:03AM
  • Re:What should a learner's language be like? by Abigail-II (Score:2) Tuesday February 01 2000, @09:33AM
  • Re:The last language by Abigail-II (Score:2) Tuesday February 01 2000, @09:49AM
  • Re:Perl as A First Language Is Scary by GnrcMan (Score:2) Tuesday February 01 2000, @09:51AM
  • Re:Perl as A First Language Is Scary by Abigail-II (Score:2) Tuesday February 01 2000, @12:08PM
  • Boy, I'm easily baited today by GnrcMan (Score:1) Tuesday February 01 2000, @01:57PM
  • Re:Boy, I'm easily baited today by Abigail-II (Score:2) Tuesday February 01 2000, @03:32PM
  • Cool by GnrcMan (Score:1) Tuesday February 01 2000, @04:01PM
  • Re:Problem with O'Reilly books by adamsc (Score:2) Friday February 04 2000, @09:12AM
  • Re:Problem with O'Reilly books by slickwillie (Score:1) Friday February 04 2000, @02:08PM
  • 67 replies beneath your current threshold.
(1) | 2