Why are scripting languages (e.g. Perl, Python, and Ruby) not suitable as shell languages? [closed]

There are a couple of differences that I can think of; just thoughtstreaming here, in no particular order: Python & Co. are designed to be good at scripting. Bash & Co. are designed to be only good at scripting, with absolutely no compromise. IOW: Python is designed to be good both at scripting and non-scripting, … Read more

Match whitespace but not newlines

Use a double-negative: /[^\S\r\n]/ That is, not-not-whitespace (the capital S complements) or not-carriage-return or not-newline. Distributing the outer not (i.e., the complementing ^ in the character class) with De Morgan’s law, this is equivalent to β€œwhitespace but not carriage return or newline.” Including both \r and \n in the pattern correctly handles all of Unix … Read more

Why is this program valid? I was trying to create a syntax error

Perl has a syntax called “indirect method notation”. It allows Foo->new($bar) to be written as new Foo $bar So that means Syntax error ! exit 0; is the same as error->Syntax(! exit 0); or error->Syntax(!exit(0)); Not only is it valid syntax, it doesn’t result in a run-time error because the first thing executed is exit(0).

Why does modern Perl avoid UTF-8 by default?

π™Žπ™žπ™’π™₯π™‘π™šπ™¨π™© β„ž: πŸ• π˜Ώπ™žπ™¨π™˜π™§π™šπ™©π™š π™π™šπ™˜π™€π™’π™’π™šπ™£π™™π™–π™©π™žπ™€π™£π™¨ Set your PERL_UNICODE envariable to AS. This makes all Perl scripts decode @ARGV as UTF‑8 strings, and sets the encoding of all three of stdin, stdout, and stderr to UTF‑8. Both these are global effects, not lexical ones. At the top of your source file (program, module, library, dohickey), prominently … Read more

How to fix a locale setting warning from Perl

Here is how to solve it on MacΒ OSΒ X v10.7 (Lion) or Cygwin (Windows 10): Add the following lines to your bashrc or bash_profile file on the host machine: # Setting for the new UTF-8 terminal support in Lion export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 If you are using Z shell (zsh), edit file zshrc: # Setting for … Read more

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