Use a counter! Set $/ to "#" to read the desired chunks.
use strict; use warnings; my $keep = 3; local $/="#"; while(<DATA>){ last unless $keep--; print; } __DATA__ 1 # 2 # 3 # 4 # 5
In reply to Re: Keep only X number of entries of a file using a delimeter
by hdb
in thread Keep only X number of entries of a file using a delimeter
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |