MC logo

Patterns I

  Practice Problems

  1. $fred = "alpha!beta!gamma";
    $fred =~ s/^.*!//;
    print "$fred\n";
  2. $fred = "alpha!beta!gamma";
    $fred =~ s/^[^!]*!//;
    print "$fred\n";
  3. $fred = "alpha!beta!gamma";
    $fred =~ s/^[^!]*!$//;
    print "$fred\n";
  4. $fred = "/this/that/../../smog/drip/../drop";
    $fred =~ s|[^/]+/\.\./||g;
    print "$fred\n";
  5. $fred = "North South East West";
    $fred =~ s/..[^r]../xxxxx/;
    print "$fred\n";

<<Using @ARGV Answer Passing Subroutine Arguments>>