in reply to Re: Re: Re: Re: Alternatives to split?
in thread Alternatives to split?
This is, of course, complete guess-work. You really should take the time to explain what it is you are trying to accompish - we know that you want to speed your application up, but what does your application do? Take the time to carefully explain yourself and get better answers. I can tell you are in a hurry because you have a plethora of typos. Take a look at How (Not) To Ask A Question.use strict; use warnings; while (<DATA>) { my $index = index($_,'|'); next unless $index; # add error checking!! my $tag = substr($_,0,$index); expensive_function($tag,$_) if $tag =~ / /; } sub expensive_function { my ($tag,$line) = @_; my ($label,$number) = split(' ',$tag,2); my ($digit) = $label =~ /_(\d+)$/; my @field = split(/\|/,$line); # now do something with all of this ... } __DATA__ START_1 123| FILE 2222| XXXX| AAAA| NEW | END_1|
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|