in reply to splitting files

Perhaps you want something like this:

my $index = 1; while ( <> ) { if ( /^SS/ ) { open OUT, '>', "$ARGV$index" or die "Cannot open '$ARGV$index' + $!"; ++$index; } print OUT; }