Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Would this be of interest to anybody? If so, I will make it freely available.

Of course yes, people might learn, the tool might spawn discussions which probably will generate further enlightenment. I guess the appropriate place to publish such a thing would be Cool Uses for Perl.

How do I start a new script? Well, depends. If it is a straight forward task, I start with a blank page and type along. If the thing at hand requires new modules I'm not familiar with, I usually fire up my own enhanced version of perlsh included in Term::ReadLine::Gnu which writes a history file, fool around with that upon the modules in question until the bits are in place, and then I'll copy the good parts from the history into my new script editors buffer. No, not cut&paste. Two terminals aligned side by side, the left one holding the new script in vi, the right one paging the perlsh history with line numbers (less -N on Linux/Cygwin). Copying from right to left is done with

:r ! l 42-64,96,14 .perlsh_history

and $HOME/bin/l reads as follows:

#!/usr/bin/perl -n BEGIN { $spec=shift; @l=split/,/,$spec; for(@l){ ($s,$e)=split/-/; $e||=$s; $_=[$s,$e]; } } CHECK { unless(@ARGV) { push @ARGV, <DATA>; chomp @ARGV; } die "usage: $0 linespec file\n" unless @ARGV; $file = $ARGV[0]; } # === loop ==== for $l(@l){ print if $.>=$l->[0] and $.<=$l->[1] } # === end === # END { if ($file) { open $fh,'<', $0; @lines = <$fh>; close $fh; open $fh,'>',$0; for(@lines){ print $fh $_; last if /^__DATA__$/; } print $fh $file,"\n"; } } __DATA__

which code isn't posted to Cool Uses for Perl yet...

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re: Starting a New Script by shmem
in thread Starting a New Script by LloydRice

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-18 22:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found