in reply to Re^2: File read and strip
in thread File read and strip
now, @new_list contains every value in @list that matches /regular expression/.my @new_list = grep { /regular expression/ } @list;
Your code:
Will set $i to undefined if $_ doesn't start with a # character, and then push it onto @new.($i)= grep { m/^#/ } $_; push @new, $i;
In other words you'll have undefined entries in @new where you probably wanted to skip those lines.
You might want to do some reading in the excellent perl documentation
updated: fixed link
|
|---|