Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ffcccc
langperl

open( PASSWD, "<", "/etc/passwd");
@users = <PASSWD>;
@shell_users = grep +(s|/bin/sh||), @users;
foreach $user (@shell_users) {
  print "Shell User: $user";
}

...

Code Block
bgColor#ccccff
langperl

open( PASSWD, "<", "/etc/passwd");
@users = <PASSWD>;
@shell_users = grep +(m|/bin/sh|), @users;
foreach $user (@shell_users) {
  $user ~= s|/bin/sh||;
  print "Shell User: $user";
}

...

[Conway 05] pg. 114, "List Processing Side Effects"
[Wall 2011] perlfunc
[CPAN] Bar, Graham. List::Utils
[CPAN] Kennedy, Adam. List::MoreUtils

...

Image Modified  Image Modified