Well, you're sasify'ing each of the fields individually, then sasify'ing them all again when you put them into the line (although this could be necessary, you appear to be stripping the delimiting pipe symbols for a reason). I'd do something like:
my $fields_string = join "|", @$rowref; my $line = sasify($fields_string);
That's one call to the subroutine rather than 5.
Another comment: you're asking Perl to compile each of the regular expressions again every time the subroutine sasify is called. You can avoid this with the "/o" operator (stick an 'o' next to the 'g' at the end of each regex). This tells Perl to compile the regex *only* once for the entire course of the program. IIRC the tr operator - see perldoc perlop or perlop - is reported to be faster for delete operations. You may wish to try something like (untested; I'm not too hot on the tr operator):
Hope that Helps$in =~ tr/^\| *//d;
In reply to Re: Fast morphing of SYBASE data to flat-file
by davis
in thread Fast morphing of SYBASE data to flat-file
by singjoh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |