$|=1; # So it works in the IDE

@a = `dir c:\\windows`; # use the inverted comma notation to capture the output
                        # instead of simply calling it with system  
                        # the \\ is necessary on modern Windows systems
foreach $e (@a){ # loop over all output lines
  print $e if $e =~ /<DIR>/; # match the "<DIR>" part of line and print it
}
