> > I don't fully understand how, when or why to use the map function - > > > > my @file = ("line 1", "line 2", "line 3", "line 4", "line 5"); > > my @test = map {/5/} @file; > > > > The result when I print @test is: > > 1 > > > > As I understand things, this is the m/5/ being "true" > > Sorta. It's the length of the list resulting from map. > Which is one. Self-correction: Got that completely wrong. First: /5/ =~ "line 5"; is done in list context. If there are no capturing parens in a regex (ie a regex is NOT like /foo(bar)baz/, then invoking a match in list context returns either null or (1) depending on whether it matches. So, in this case, it returns (1). So, that is added to the overall map result list. So the map result list ends up as (1). When you do: print @array; perl prints out each of the elements of @array. So, you get 1, the first and only element of the map result list.