in reply to Comparing 2 arrays but ignoring certain patterns
Omit building the hash and try the following grep that uses smart matching:
@newlist = grep !((split /:/)[0] ~~ @removelist), @testlist;
Output:
ctahci ctsata_1:25:seed
Update:
NetWallah provided excellent fixes for your code, and it generates your desired output. You may still, however, use the above grep that doesn't use a hash.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing 2 arrays but ignoring certain patterns
by hongping (Novice) on Jun 29, 2012 at 07:12 UTC | |
by Anonymous Monk on Jun 29, 2012 at 07:20 UTC | |
by hongping (Novice) on Jun 29, 2012 at 07:29 UTC | |
by Anonymous Monk on Jun 29, 2012 at 07:41 UTC |