in reply to solved: beginners trap: one liner

If you are in linux, you might want to add a newline; for example, perl -le 'print("aaa");' -- adding the -l auto-adds newline; useful for oneliners. (edit: without the newline, the aaa and the next command-line prompt will be next to each other, like aaa[##]Here'sMyCommandLinePrompt:)

If you are in windows, single quote ' is not a valid quote mark for the command line, so swap quotes around: perl -le "print('aaa');"

Replies are listed 'Best First'.
Re^2: beginners trap: one liner
by footpad (Monsignor) on Jan 03, 2020 at 20:02 UTC

    Actually, the behavior on Windows (10, 1903 edition) appears to depend on one's shell.

    I ran toohoo's test in different "command windows" on my Windows laptop.

    Here's what I found:

    • Command prompt (CMD): printed nothing with a line feed.
    • Git bash: printed the message and added a line feed.
    • WSL: bash prompt: printed the message with no line feed.
    • PowerShell prompt1: printed nothing.

    I don't think these results surprise anyone familiar with how Windows has implemented some of these things; however, the variation may surprise a few others.

    (Oh, should mileage vary [likely], I suppose it's worth mentioning that I have two copies of perl installed on my laptop: the one provided with git bash and a relatively recent copy of Strawberry perl.)

    Hope this helps...

    -- f

    1 - There are multiple versions of PowerShell available; I use generally use Core, but the same behavior was seen in the Desktop version as well.

      I'm not aware of any native port of bash. The two you mention specifically run in unix emulations (MSYS and WSL specifically), not Windows.

        You may be right about that (though I think you'd get some pushback from members of the WSL team, especially since you can bring bring own distro to your WSL instance.)

        Given today's cloud connected world (where Macs, PCs, and VMs need to integrate on a daily basis), it seems overly silly (to me) to be overly pedantic about such things.

        From a practical standpoint, the observed results remain the same. If we're going to help people with the problems they see, I think we should learn as much as we can about the tools they use.

        That's my take; you're perfectly free to disagree.

        --f

Re^2: beginners trap: one liner
by toohoo (Beadle) on Jan 04, 2020 at 03:45 UTC

    Hello @pryrt,

    Many thanks, this was it. Finally it will run under Linux. But now I develop under Win10.

    Best regards