News for hackers. Stuff that matters.
Re:Why Perl? by buster on Wednesday November 16, 2011 @08:22AM (#3242988)
I'll visit that channel when back from vacation for sure.

To do what you want you could use list comprehensions or the filter(function, sequence) function:

List comprehension:

  links = ["https://securesite.com", "http://unsecuresite.com", "https://sec2.com", "http://unsec2.com"]
  [url for url in links if not url.startswith("https")]
  >>> ['http://unsecuresite.com', 'http://unsec2.com']
filter() + lambda:

  links = ["https://securesite.com", "http://unsecuresite.com", "https://sec2.com", "http://unsec2.com"]
  filter(lambda url: not url.startswith("https"), links)
  ['http://unsecuresite.com', 'http://unsec2.com']
I'd go with the list comprehension, from your use of map i'd guess you'd go with the filter ;)

Of course you'd replace the url.startswith with whatever your criteria is.

Re:Why Perl? by Mithaldu on Wednesday November 16, 2011 @08:28AM (#3243008)
Ah, that's kinda what i expected. Suddenly the two languages look fairly similar, no? :)

Also, list comprehension doesn't look bad to me. It's just a slightly weird and more verbose syntax of doing map, while filter does an in-place operation.