Reputation: 289
Got a script which Im trying to debug but I cant figure out the meaning of this regex and googling "caret" and "pound" isnt helping.
$line !~ /^#/
Not a complicated question I'm sure but I'm locked away from all my perl books until after xmas!
I know that the !~
means 'doesnt match...' of course!
Upvotes: 0
Views: 226
Reputation: 46965
This is checking for all lines that do not start with "#". Typically comments in many programming language.
Upvotes: 1
Reputation: 160261
Caret is beginning of line. # is a #. It's looking for non-comment lines (and assuming comments start in the first column, or at least at the beginning of whatever line
is).
Upvotes: 3