You can use $/ :)

$ ls -l zzz -rw-rw-rw- 1 tux users 60892 Feb 12 15:54 zzz $ perl -CS -Mautodie -wE'$/=\3000;my$i="0000";while(<>){open my $fh, " +>:encoding(utf-8)", "zz".$i++;print $fh $_}' < zzz $ ls -l zz0* -rw-rw-rw- 1 tux users 3624 Feb 12 15:58 zz0000 -rw-rw-rw- 1 tux users 3681 Feb 12 15:58 zz0001 -rw-rw-rw- 1 tux users 3661 Feb 12 15:58 zz0002 -rw-rw-rw- 1 tux users 3655 Feb 12 15:58 zz0003 -rw-rw-rw- 1 tux users 3652 Feb 12 15:58 zz0004 -rw-rw-rw- 1 tux users 3634 Feb 12 15:58 zz0005 -rw-rw-rw- 1 tux users 3640 Feb 12 15:58 zz0006 -rw-rw-rw- 1 tux users 3646 Feb 12 15:58 zz0007 -rw-rw-rw- 1 tux users 3631 Feb 12 15:58 zz0008 -rw-rw-rw- 1 tux users 3631 Feb 12 15:58 zz0009 -rw-rw-rw- 1 tux users 3692 Feb 12 15:58 zz0010 -rw-rw-rw- 1 tux users 3659 Feb 12 15:58 zz0011 -rw-rw-rw- 1 tux users 3647 Feb 12 15:58 zz0012 -rw-rw-rw- 1 tux users 3648 Feb 12 15:58 zz0013 -rw-rw-rw- 1 tux users 3634 Feb 12 15:58 zz0014 -rw-rw-rw- 1 tux users 3643 Feb 12 15:58 zz0015 -rw-rw-rw- 1 tux users 2514 Feb 12 15:58 zz0016

Enjoy, Have FUN! H.Merijn

In reply to Re: how to split a file.txt in multiple text files by Tux
in thread how to split a file.txt in multiple text files by saulnier

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.