in reply to Chopping the beginning of a string?
I don't know performance wise which is better, but I'm guessing 'substr' would be test if you just need to remove the first character. But if you need to separate and capture more than just one substring from the line, and the substrings are at the same location in every line, then unpack might be test. If performance is your concern, just create one loop that does one 1000(or 10,000, or 100,000) times, and then another loop that does the other 1000 times - capture the time at the start and end of each, and compare.($first, $rest) = unpack("A1 A*", $original_string);
|
|---|