Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
thanx for any help, I hope this is easy to understand the module's Text::Break, to call it use the break method. The code should be self-explanitory.package Text::Break; $VERSION = 1.1; sub break() { local ($extra, $num, $extra2, $extra4, @text, $status); local $text = \@_; shift @$text; $text3 = @$text; if ($text3 =~ /,\s/) { ($text, $num) = split ", ", @$text, 2; } else { $num = 24 } local $counter = 1; $status = "yes"; $extra2 = 0; &printer; sub printer() { undef(@text); while ($extra2 <= $#$text) { $text[$extra4] = $$text[$extra2]; $extra2++; $extra4++; } $extra4 = 0; foreach $line (@text) { if ($counter%24==0 && $status == "yes" && $counter != 0){ print "--more--"; $extra = <STDIN>; if ($extra =~ /^[bB]/ && $counter != 24) { $extra2 = $counter - 48; undef($status); goto &printer; goto LAST; } elsif ($extra =~ /^[xX]/) { goto LAST; } } print $line; $counter++; $status = "yes"; } } LAST: if($extra) { } 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Breaking Text
by btrott (Parson) on Aug 20, 2000 at 00:21 UTC | |
by Anonymous Monk on Aug 20, 2000 at 00:40 UTC | |
|
Re: Breaking Text
by chromatic (Archbishop) on Aug 20, 2000 at 01:17 UTC | |
|
Re: Breaking Text
by btrott (Parson) on Aug 20, 2000 at 00:52 UTC |