Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Context tutorial

by toro (Beadle)
on Jun 16, 2011 at 23:49 UTC ( #910051=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Context tutorial
in thread Context tutorial

You're right. Don't know what I did before. deleting...

$ perl -e "$now = localtime(); print $now;" syntax error at -e line 1, near "=" Execution of -e aborted due to compilation errors.

As explained to me by ikegami and runrig in the chatterbox: perl -e "$now = localtime(); print $now;" and perl -e ' = localtime(); print ;' are equivalent in bash (Ubuntu's default) unless $now is an Environmental variable within the Bash shell.

In other words if one is doing some Bash scripting and has defined $1 as a variable within that shell-script ... then the way to access that same system (environmental) $1 is to use perl -e " ... $1 ... ".

Cheers.


Comment on Re^3: Context tutorial
Select or Download Code
Re^4: Context tutorial
by ikegami (Pope) on Jun 17, 2011 at 00:20 UTC

    bash does support double quotes, but «\», «"» and «$» (and maybe more) are special in double quotes.

    $ perl -E'my $x = qq{abc\\def}; say $x' abc\def $ perl -E"my \$x = qq{abc\\\\def}; say \$x" abc\def
Re^4: Context tutorial
by Anonymous Monk on Jun 17, 2011 at 04:22 UTC
    On guard perl -le print~~localtime
      ~~? Can you provide a reference please?
        :) see perlop
        $ perl -le print~localtime
        ╣мы▀╡иж▀╬╚▀╧╬┼╬╔┼╠╩▀═╧╬╬
        
        $ perl -le print~~localtime
        Fri Jun 17 01:16:42 2011
        
        $ perl -le print~~~localtime
        ╣мы▀╡иж▀╬╚▀╧╬┼╬╔┼╦╔▀═╧╬╬
        
        $ perl -le print~~~~localtime
        Fri Jun 17 01:16:49 2011
        
        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2014-09-23 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (241 votes), past polls