Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: splitting up a long text at regular intervals

by EvanCarroll (Chaplain)
on Oct 30, 2005 at 23:25 UTC ( #504076=note: print w/replies, xml ) Need Help??


in reply to splitting up a long text at regular intervals

I'm not sure as to what exactly your asking, but allow me to point you into the direction of unless ($. % 15) {}


Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re^2: splitting up a long text at regular intervals
by pg (Canon) on Oct 30, 2005 at 23:43 UTC

    $. is error prone, as one can have multiple files open in a program, but there is only one $. I would rather call input_line_number() with specific file handler.

    use IO::Handle; open(MYSELF1, "<", "test.pl"); open(MYSELF2, "<", "test.pl"); while (<MYSELF1>) { print "after reading from myself1: $.\n"; if ($. % 2) { <MYSELF2>; print "after reading from myself2: $.\n"; } print "returned values from input_line_number: ("; print MYSELF1->input_line_number(), ", "; print MYSELF2->input_line_number(), ")\n"; } close(MYSELF1); close(MYSELF2);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://504076]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2023-02-03 06:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (24 votes). Check out past polls.

    Notices?