Ad space (banner)
Lesson 20 / 20

[Project] Build a small inventory system

In this lesson you combine the hashes, arrays, and subroutines covered so far into a simple inventory system. It is the capstone of this Perl introduction.

Real business systems use this combination constantly: represent something like a product as a hash reference, and manage many of them together in an array.

The sample code manages the product information as an array of hash references, and prints the listing with foreach while working out each stock status.

Regular expressions, references, and hashes — everything covered in these lessons — are the foundations of real log-analysis and text-processing work. Getting into the habit of writing small programs while paying attention to Perl's sigils is the shortest path to using Perl professionally.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run Perl directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)