Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: @ARGV ignores quotes

by hrcerq (Scribe)
on Jun 19, 2021 at 21:37 UTC ( #11134042=note: print w/replies, xml ) Need Help??

in reply to @ARGV ignores quotes

I hope I'm not saying anything stupid, but is ​ a subroutine call? If so, isn't this notation deprecated?

return on_success() or die;

Replies are listed 'Best First'.
Re^2: @ARGV ignores quotes [ZERO WIDTH SPACE]
by kcott (Bishop) on Jun 19, 2021 at 23:28 UTC

    G'day hrcerq,

    "I hope I'm not saying anything stupid, but is ​ a subroutine call?"

    There's certainly nothing "stupid" in your question. I was going to comment on that directly myself before scrolling down and seeing your post.

    The ​ is an HTML entity reference: a code which references a specific character. This is its decimal form. You may also see this in its hexadecimal form, ​, or as a named entity, ​. It is the Unicode® ZERO WIDTH SPACE (U+200B) character — the PDF code chart "General Punctuation Range: 2000206F" has details; "Wikipedia: Zero-width space" has further discussion.

    How that got into the presented code — perhaps an artefact of a word processor used to write the code; maybe copied from an email; or whatever — is immaterial. The fact that the OP didn't check the Preview before posting (also note the obvious, broken <{line-break}/code> end tag) is of much more concern to me: what other problems exist in the code (not shown) that the OP may not have bothered to check either.

    "If so, isn't this notation deprecated?"

    The notation is not so much "deprecated" as syntactically incorrect. Note that the following did not need the strict or warnings pragmata for the compilation to be aborted.

    $ perl -e ' my $job_flag = 0; foreach my $i (0..$#ARGV) { &#8203;$opt{"job"} .= $ARGV[$i]." " if($job_flag); &#8203;$job_flag = 1 if($ARGV[$i] =~ /^(\-\-|\-)job$/); &#8203;undef $ARGV[$i] if($job_flag); } ' Number found where operator expected at -e line 4, near "&#8203" (Missing operator before 8203?) Number found where operator expected at -e line 5, near "&#8203" (Missing operator before 8203?) Number found where operator expected at -e line 6, near "&#8203" (Missing operator before 8203?) syntax error at -e line 4, near "&#8203" syntax error at -e line 5, near "&#8203" syntax error at -e line 6, near "&#8203" Execution of -e aborted due to compilation errors.

    The OP did not run this code!

    Updates: I had some issues with the title of this post; three versions tried; see "What are the formatting rules for the "Title" of posts?" for details. I'd also fixed a copy/paste error: the first line of the code I posted ($ perl -e ') was originally missing.

    — Ken

Re^2: @ARGV ignores quotes
by AnomalousMonk (Bishop) on Jun 19, 2021 at 22:41 UTC

    Near as I can tell, &#8203; is a "ZERO WIDTH SPACE" HTML entity. I have no idea what it's doing there.

    Give a man a fish:  <%-{-{-{-<

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11134042]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-05-25 00:15 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (84 votes). Check out past polls.