Here's another option:
use strict; use warnings; local $/ = "//\n"; while (<>) { chomp; my ( $len, $id, $parts ) = /(\d+)\s+(.+?)\n(.+)/s; $parts =~ s/\n//g; $parts =~ /.{$len}/p; print ">$id\n${^MATCH}\n${^POSTMATCH}\n" }
If you're using Perl v5.14+, you can combine the substitution and matching into a single line as follows:
$parts =~ s/\n//gr =~ /.{$len}/p;Hope this helps!
In reply to Re: create an one-line format for this
by Kenosis
in thread create an one-line format for this
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |