J
jackster the jackle
I'm trying to delete elements of an array if they match a string but my
code always leaves some matches and I think it's because it's having
trouble iterating through the same array it is trying to delete from, is
that true?
Here is the code:
@acl_all_array.each do |range|
if range[/access-list/]
@acl_all_array.delete(range)
puts range
end
end
Is this the correct way to delete matched entries from an array?
Thanks
John
code always leaves some matches and I think it's because it's having
trouble iterating through the same array it is trying to delete from, is
that true?
Here is the code:
@acl_all_array.each do |range|
if range[/access-list/]
@acl_all_array.delete(range)
puts range
end
end
Is this the correct way to delete matched entries from an array?
Thanks
John