What does “1;” mean in Perl?

1 at the end of a module means that the module returns true to use/require statements. It can be used to tell if module initialization is successful. Otherwise, use/require will fail. $somevar is a variable which is accessable only inside the block. It is used to simulate “static” variables. Starting from Perl 5.10 you can … Read more

Javascript regex compared to Perl regex

From ECMAScript 2018 onwards, many of JavaScript’s regex deficiencies have been fixed. It now supports lookbehind assertions, even unbounded ones. Unicode property escapes have been added. There finally is a DOTALL (/s) flag. What is still missing: JavaScript doesn’t have a way to prevent backtracking by making matches final (using possessive quantifiers ++/*+/?+ or atomic … Read more

How can I find memory leaks in long-running Perl program?

It may be relevant that Perl never gives memory back to the system by itself: It’s all up to malloc() and all the rules associated with that. Knowing how malloc() allocates memory is important to answering the greater question, and it varies from system to system, but in general most malloc() implementations are optimized for … Read more

What’s the use of in Perl?

The answers above are all correct, but it might come across more plainly if you understand general UNIX command line usage. It is very common to want a command to work on multiple files. E.g. ls -l *.c The command line shell (bash et al) turns this into: ls -l a.c b.c c.c … in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)