What your code is doing is printing the entire line (substr $_, 0,) up to but excluding the last backslash. Obviously that's not what you want.
What you need is a regex. /\B(-I\S+)/ will deliver your desired bits in $1, ready to be printed. You need a /g modifier to catch all matches and iterate over them via while. print "$1\n" while /\B(-I\S+)/g; ____________In reply to Re: Transforming only parts of input
by Aristotle
in thread Transforming only parts of input
by amoura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |