Mirco Wahab wrote:
> One could rewrite it somehow 'different',
> as a "split", like:
>
> use strict;
> use warnings;
> ...
> [split /$reg/]
> ...
...
reg and output slightly modified to match yours:
...
no warnings 'qw';
my @end = qw{R e f e r e n c e \\s # \\d+};
my $reg = '\s+('.(join '|',map join('',@$_),map[@end[0..$_]],0..$#end).')$';
while( ) {
chomp;
print "in : >$_<\n";
print "out: >", (split /$reg/)[0], "<\n"
}
...
Regards
M.