What are some potential pitfalls when converting Perl scripts to PHP, as seen in the provided code examples?

One potential pitfall when converting Perl scripts to PHP is the difference in syntax for regular expressions. In Perl, the =~ operator is commonly used to match patterns, while in PHP, the preg_match function is used instead. To fix this issue, you can replace the =~ operator with preg_match in your PHP code. PHP Code Snippet:

// Perl code: if ($string =~ /pattern/) { ... }
// PHP equivalent:
if (preg_match('/pattern/', $string)) {
    // code block
}