my $out_fh; while (<$in_fh>) { if (my ($out_fn) = /^< (.*)/) { open($out_fh, '>', $out_fn) or die("Unable to create file \"$out_fn\": $!\n"); } else { print $out_fh $_; } }
Update: Removed chomp.
Update: Removed unneeded undef $out_fh;.
In reply to Re: How to generate files based on some special character?
by ikegami
in thread How to generate files based on some special character?
by unix_95054
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |