#!/usr/bin/perl use strict; use warnings; open my $fh, '<', 'list.txt' or die $!; chomp(my @hosts = <$fh>); close $fh; while (my @five = splice @hosts, 0, 5) { print qq{command @five\n}; } # prints: command host1 host2 host3 host4 host5 command host6 host7 host8 host9 host10 command host11 host12
In reply to Re^2: split on every n lines
by hbm
in thread split on every n lines
by sunil9009
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |