Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Confession of a hard headed Monk

by Lady_Aleena (Curate)
on May 16, 2017 at 17:26 UTC ( #1190396=note: print w/replies, xml ) Need Help??


in reply to Re^2: Confession of a hard headed Monk
in thread Confession of a hard headed Monk

Bad, bad, bad logic in a part of the usage code I provided above...

# If you don't add 1 to the result of the division below, # you will get an additional column. my $splicer = (scalar(@list) / $columns) + 1;

It should be...

# Add 1 to the result of the division below # if list is not evenly divisible by $columns. my $splicer = int(scalar(@list) / $columns); $splicer += scalar(@list) % $columns > 0 ? 1 : 0;

Sorry for not thoroughly testing that part. 8(

No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena

Replies are listed 'Best First'.
Re^4: Confession of a hard headed Monk
by choroba (Bishop) on May 16, 2017 at 19:05 UTC
    Which can be shortened to
    my $splicer = int(@list / $columns) + (@list % $columns > 0);

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

      That gets a little long for things like the following:

      int(scalar split(/, /, $string) / $columns_for_string) + (scalar split +(/, /, $string) % $columns_for_string > 0);

      8)</c>

      No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
      Lady Aleena

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2019-10-15 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?