Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^7: CGI::Ajax No head/html tags, nowhere to insert. Returning javascript anyway.

by Anonymous Monk
on Sep 02, 2013 at 02:33 UTC ( #1051872=note: print w/ replies, xml ) Need Help??


in reply to Re^6: CGI::Ajax No head/html tags, nowhere to insert. Returning javascript anyway.
in thread CGI::Ajax No head/html tags, nowhere to insert. Returning javascript anyway.

Whoa, that's creative; I don't know how I managed to communicate that, but I wasn't trying to communicate that

If you're trying to learn new syntax, esp if you're working on something already , start a new file (start 10 new files actually), and type it :) that way a year later, you have code you wrote with your own fingertips showing you whats important about that new syntax -- stuff like that you remember :) well I remember

Hopefully this is clearer (I inglish you not my strong porcupine suit )

#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd pp /; my $str = 'h'; dd $str; ## "h" $str .= 'i'; dd $str; ## "hi" ## one way to write this mini-if aka ternary #~ $str .= 1 > 2 ? '; uh oh 1>2' : '; ok 1<2' ; ## same exact thing, just with more whitespace , easier to read #~ $str .= 1 > 2 #~ ? '; uh oh 1>2' #~ : '; ok 1<2' #~ ;;; ## once again the same exact thing (this time for real) ## the parens provide visual disambiguation ## and not important in this example, also disambiguation for operator + precedence ## $str .= ( 1 > 2 ) ? ( '; uh oh 1>2' ) : ('; ok 1<2'); dd $str; ## "hi; ok 1<2" $str .= do { my $foo = 0; for(1..3){ $foo .= $_; } $foo; ## last statement is like "return $foo;" }; # end of do dd $str; ## "hi; ok 1<20123" __END__ "h" "hi" "hi; ok 1<2" "hi; ok 1<20123"

porcupine suit aka "armouire" -- ah gess, the pans are mah favreeeet :D


Comment on Re^7: CGI::Ajax No head/html tags, nowhere to insert. Returning javascript anyway.
Download Code
Replies are listed 'Best First'.
Re^8: CGI::Ajax No head/html tags, nowhere to insert. Returning javascript anyway.
by Anonymous Monk on Sep 02, 2013 at 02:38 UTC
    ## $str .= ( 1 > 2 ) ? ( '; uh oh 1>2' ) : ('; ok 1<2'); ## is the same as like if( 1 > 2 ) { $str .= ( '; uh oh 1>2' ); } else { $str .= ( '; ok 1<2' ); }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-07-08 03:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls