Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Concatenating strings with different length

by karlgoethebier (Parson)
on Nov 30, 2012 at 15:26 UTC ( #1006485=note: print w/replies, xml ) Need Help??


in reply to Concatenating strings with different length

Consider using perltidy for formatting your code.

Reformatted example:

for $i ( 0 .. $#p2 ) { #print "$p1[$i] vs $p2[$i]\n"; $mism_pos{$i} = 1 if ( $p1[$i] eq $p2[$i] ); } #print sort keys %mism_pos,"\n"; if ( keys %mism_pos ) { for $i ( 0 .. $#p2 ) { if ( defined $mism_pos{$i} ) { if ( @new1 && @new2 ) { push @new, @new1, 'and', @new2, $p2[$i]; @new1 = (); @new2 = (); } else { push @new, $p2[$i]; } } else { push @new1, $p1[$i]; push @new2, $p2[$i]; } } }

The code isn't better but it looks a bit better. This makes live easier.

If you are using vim look here.

If you are using emacs type:

C-x h esc 1 esc |

In the minibuffer you will see: Shell command on region:

Type perltidy (assuming you installed it) and press ENTER.

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006485]
help
Chatterbox?
[Corion]: ambrus: AnyEvent(::HTTP) doesn't integrate well with Prima, that's my main problem
[Corion]: There is a weirdo shim because there is a POE integration for Prima, and if you use that, you can use the POE adapter of AnyEvent. What I'd want is something transport agnostic that parses HTTP or produces HTTP output, so that the communication with ...
[Corion]: ... the socket is done by my code. Ideally that module would not be based on callbacks ;)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2016-12-07 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.