tm604 |
eval: my $txt = "this is a test"; my $rslt = substr($txt, 4, length($txt) - 4, undef); [ $txt, $rslt ]; |
buubot |
tm604: ["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. |
rindolf |
eval: my $txt = "this is a test"; my $rslt = substr($txt, 4, - 4, q{}); [ $txt, $rslt ]; |
buubot |
rindolf: ["thistest"," is a "] |
tm604 |
Just surprised that omitting the length for substr isn't the same as passing undef. |
anno |
tm604: sometimes perl makes a difference between "not specified" and undef |
ishi |
tm604: wouldn't regexpr be shorted? I'm not sure what passes as 'neat' in perl :) |
ishi |
shorter, even... |
rindolf |
eval: @s = ("Long string this is a test" =~ m{\A(.{0,6})(.*?)\z}ms); [@s] |
buubot |
rindolf: ["Long s","tring this is a test"] |
rindolf |
tm604: will that work? |
tm604 |
rindolf: thanks, that may be a better option. |
rindolf |
tm604: nice. :-) |
Khisanth |
that would definitely not be "better" ... |
ishi |
it's slower ;) |
tm604 |
hmm, 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. |
sacx |
nah you need an FPGA |