Subroutines and data

This part moves code into subroutines and data into structures: arguments read from @_, references taken with a backslash, and the arrays of hashes that a real record set needs.

4.1 Subroutines define a subroutine with sub, call it with arguments, return a value explicitly, and mark a helper private Open 4.2 Arguments in @_ read @_, set defaults, treat its elements as aliases, and pass named arguments with a hash Open 4.3 References take a reference with a backslash, dereference arrays and hashes, and pass large data without copying it Open 4.4 Nested data structures arrays of hashes and hashes of arrays, walked with loops, inspected with Data::Dumper, and copied safely Open

Lessons