Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,954
    Rep Power
    1225
    Originally Posted by Laurent_R
    Code:
    last if $filename =~ /q/i; # exit the loop if user entered "q" or "Q"
    You might want to change that to:
    Code:
    last if $filename =~ /^q$/i; # exit the loop if user entered "q" or "Q"
    or
    Code:
    last if lc $filename eq 'q'; # exit the loop if user entered "q" or "Q"
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Location
    Paris area, France
    Posts
    843
    Rep Power
    496
    Yes, of course, you are right, I wanted to have it:

    Code:
    last if $filename =~ /^q$/i; # exit the loop if user entered "q" or "Q"
    but just forgot some of the typing.

    In fact, I originally typed:

    Code:
    last if $filename eq 'q' or $filename eq 'Q';
    but found it a bit ugly. So I changed it to a regex but missed part of what I wanted to type (the ^ and the $), and I did not think of using lc which is probably a more elegant solution.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo