http://qs321.pair.com?node_id=1064635


in reply to Variable number of foreach loops

Generally speaking, you use recursion for this, as BrowserUK did, often calling a separate subroutine (this is where you would put the print-statement) from the innermost iteration. A Perl subroutine can call itself any (reasonable) number of times.