Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 (Friar) 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 browsing the Monastery: (8)
As of 2019-09-16 16:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (196 votes). Check out past polls.

    Notices?