in reply to Keep only X number of entries of a file using a delimeter
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Keep only X number of entries of a file using a delimeter
by SimonPratt (Friar) on Oct 15, 2015 at 15:48 UTC | |
|
Re^2: Keep only X number of entries of a file using a delimeter
by Anonymous Monk on Oct 13, 2015 at 13:52 UTC |