Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Suggestion on rewriting small code

by Anonymous Monk
on Aug 21, 2019 at 12:12 UTC ( #11104808=note: print w/replies, xml ) Need Help??


in reply to Re: Suggestion on rewriting small code
in thread Suggestion on rewriting small code

A more perlish way of doing it: 

my $str = join ' || ', map "job==$_", @arr;
$str = qq{"$str"};

# TIMTOWTDI:

my $str = join '', '"', (join ' || ', map { "job==$_" } @arr), '"';
  • Comment on Re^2: Suggestion on rewriting small code

Replies are listed 'Best First'.
Re^3: Suggestion on rewriting small code
by rsFalse (Hermit) on Aug 27, 2019 at 16:04 UTC
    One more way for those who likes to join:
    my $str = join ~~( join q[ || ], map { "job==$_" } @arr ), ( q["] ) x +2;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2020-12-01 16:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (12 votes). Check out past polls.

    Notices?