It's slower - Fortune [possible satire]

tm604eval: my $txt = "this is a test"; my $rslt = substr($txt, 4, length($txt) - 4, undef); [ $txt, $rslt ];
buubottm604: ["this"," is a test"]
tm604^ can anyone suggest a neater way of writing that? thought undef for the 3rd substr parameter would work instead of explicitly giving a length.
rindolfeval: my $txt = "this is a test"; my $rslt = substr($txt, 4, - 4, q{}); [ $txt, $rslt ];
buubotrindolf: ["thistest"," is a "]
tm604Just surprised that omitting the length for substr isn't the same as passing undef.
annotm604: sometimes perl makes a difference between "not specified" and undef
ishitm604: wouldn't regexp be shorted? I'm not sure what passes as 'neat' in perl :)
ishishorter, even...
rindolfeval: @s = ("Long string this is a test" =~ m{\A(.{0,6})(.*?)\z}ms); [@s]
buubotrindolf: ["Long s","tring this is a test"]
rindolftm604: will that work?
tm604rindolf: thanks, that may be a better option.
rindolftm604: nice. :-)
Khisanththat would definitely not be "better" ...
ishiit's slower ;)
tm604hmm, since I'm passing this through SOAP::Lite through a VPN on the other side of the world maybe three times a day, I think I'll have to rewrite this part in highly-efficient x64 assembler with fallback to GPU if available.
sacxnah you need an FPGA
Channel#perl
NetworkFreenode
TaglineMission critical fast
Published2010-08-06