We will talk in dept about regular expressions in a Chapter 11, Regular Expressions, but let's take a small glimpse now.
We could rewrite the last example using a regular expression:
$ [[ $FILE =~ \.pl$ ]] && cp "$FILE" scripts/
As the single dot or period has a special meaning in regular expressions, we need to escape it with \.
The following screenshot shows the regular expression matching working with a file called my.pl and another called my.apl. The match correctly shows for the file that ends in .pl: