I have written a sub to decode a sting of information from a 15 character base 36 input. I haven't tested it yet, however I believe it should work. My question is, where I have it splitting the data via substr as 5 separate lines, is there a simpler way of doing this, like splitting it into an array with a regular expression? It ends up returning it as an array anyway so if I can skip making the array that would be great.
My includes for reference:And the sub in question:use strict; use warnings; use POSIX; use DBI; use Crypt::Eksblowfish::Bcrypt qw(bcrypt_hash); use Math::BaseCalc;
Thankyou all for your help :)sub ReadDaycode { # Get daycode. my $DC = $_[0]; # Divide daycode into its parts my $BoardTotal = $B10->to_base(substr($DC,0,4)); my $AvgSample = $B10->to_base(substr($DC,4,2)); my $Level = $B10->to_base(substr($DC,6,2)); my $Exp = $B10->to_base(substr($SC,8,5)); my $Fails = $B10->to_base(substr($DC,13,2)); return ($BoardTotal,$AvgSample,$Level,$Exp,$Fails); }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |