[8167] in Perl-Users-Digest
Perl-Users Digest, Issue: 1785 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 2 03:28:14 1998
Date: Mon, 2 Feb 98 00:00:34 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 2 Feb 1998 Volume: 8 Number: 1785
Today's topics:
Re: 5 REAL languages (was: Re: AOL SPAM) <vladimir@cs.ualberta.ca>
[utility] submit "unix_command" (Michael Wang)
Banner help? <mikeh@medina.net>
Re: Banner help? <corky@ultranet.com>
Bidirectional open2 and buffered output... <chris@ixlabs.com>
Re: boston.pm.org <dha@panix.com>
Re: dc.pm.org (brian d foy)
Decent Perl books <cmheiden@mtu.edu>
Re: Don't forget the Perl Journal (was Re: Good place t <joseph@5sigma.com>
Re: Forcing 7-digit number? <jason@primal.ucdavis.edu>
Re: Generating the partitions of a string <scottj@mthcsc.wfu.edu>
Help: Testing a CGI script locally/Path to browser (Linda Starr)
Re: How to write fixed format data? <metcher@spider.herston.uq.edu.au>
Re: New Perl-Oriented Web Site has materials not availa <r_cheon@alcor.concordia.ca>
pst (cdog)
Re: Public Response to Private Flame (albeit machine-ge <vladimir@cs.ualberta.ca>
Re: Public Response to Private Flame (albeit machine-ge <stuartc@ind.tansu.com.au>
s/// Usage Problems <bruceh@interaccess.com>
summary: speed comparision of 5 perl programs emulating (Michael Wang)
Re: Survival Of perl <zenin@best.com>
Unpack float <pbanks@ix.netcom.com>
Re: Using -w <vladimir@cs.ualberta.ca>
When was perl created? <jonspage@geocities.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 01 Feb 1998 21:01:43 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Re: 5 REAL languages (was: Re: AOL SPAM)
Message-Id: <omen1md594.fsf@tees.cs.ualberta.ca>
In article <34D3B21A.7276@earthling.net> Rich Grise <lovegod@earthling.net> writes:
> there is exactly one programming language: Machine Language. (well,
> OK, one per machine variation.) The rest are translators.
Machine language serves only as a front end to a set of microprograms.
And these in turn are simply a device allowing us to organize the life
of our transistors and other electronic components. Which in turn are
ingenious and by no means primitive electron highways... and so on.
------------------------------
Date: 2 Feb 1998 05:15:47 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: [utility] submit "unix_command"
Message-Id: <6b3kq3$70a$1@news.ml.com>
I wrote a utility called submit. The following is what will be shown
when you type "submit" without arguments. If you are interested it is
available from ftp://ftp.mindspring.com/users/mwang/submit.
Accidently, you can use my "niftp" (non-interactive ftp) to get the
utility. niftp is available from ftp://ftp.mindspring.com/users/mwang/niftp.
Send your comments to me, thanks.
Usage: submit unix_command
submit allows you disconnect from the system after submitting a
unix_command. submit spawns a child process to execute unix_command,
and then exits. The child process is adopted by init, and runs
independent of the parent.
The stdout and stderr of the unix_command is saved in the LOGFILE
($HOME/submit.log for normal users, and /opt/local/log/submit.log).
Send comments to Michael Wang, mwang@mindspring.com.
version 1.0, Feb 1998.
Examples:
submit make
submit "make > make.log"
submit 'make CC="gcc" CFLAGS="-g -O2"'
submit make \> make.log
submit make CC=\"gcc\" CFLAGS=\"-g -O2\"
------------------------------
Date: Sun, 01 Feb 1998 21:33:14 -0500
From: Mike Hallock <mikeh@medina.net>
Subject: Banner help?
Message-Id: <34D53069.63EA547D@medina.net>
Could someone please help me out here?
I need three scripts: redirect.pl, banner.pl, and addbanner.pl, as well
as a flat database. I then want addbanner to add stuff to the
flatdatabase, like the URL | IMAGEBASEURL | IMAGENAME, and then I want
redirect and banner to read from it, and work together to print out the
coorisponding data.
That way, someone in my banner can just use:
<a href=http://name.com/cgi/redirect.pl><img
src=http://name.com/cgi/banner.pl></a>
And it would display the banner and link.
For example, look at http://www.planetquake.com, they have a benner
script that they won't let me see, but it's set up like that.
--
+----------------------------------------------------------------------+
| /\___ |\___ ___/||\___ |\ |\ |\___ |\ /_\ |\___ |
| | _ / | __/ \ __||_ __\| || | | __/ | \|\ /| | __/ |
| ||_/ | __| \_ \ | | | || |__ | __| | \ |\|_ | __| |
| || |___/ /__/ |_| |_| \___\|___/ |_|\_| \ / |___/ |
| mikeh@medina.net * Mike Hallock * http://defcon4.medina.net/ |
+-====================================================================-+
------------------------------
Date: Sun, 01 Feb 1998 21:57:37 -0500
From: Bob Trieger <corky@ultranet.com>
Subject: Re: Banner help?
Message-Id: <34D53620.6610@ultranet.com>
Mike Hallock wrote:
>
> Could someone please help me out here?
>
> I need three scripts: redirect.pl, banner.pl, and addbanner.pl, as well
> as a flat database.
Can you help me out here?
I need 3 million dollars, a new Lexus and a house in a temperate
climate.
------------------------------
Date: Sun, 01 Feb 1998 17:52:29 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: Bidirectional open2 and buffered output...
Message-Id: <34D526DD.771F@ixlabs.com>
Hi,
I have a program (quake server) which I need to do an open2 call to, so
that I can read it's output and also send input to it. The program
begins sending many lines of text as soon as it's invoked, and always
accepts input as well.
The examples I have found for open2 in the FAQ, Camel, man page suck
and/or are poorly documented.
In the example below, the program runs without errors but there is no
output to the screen. If the program fails (UDP port in use, for
example), the STDOUT seems to get flushed.
I am flushing these handles every way I knwo how and nothing seems to
help.
Also: once I get this working, how can I send input to the program
without blocking on <STDIN>?
Thanks!
Chris
PS Why can't open(THIS, '|this|') just be made to work!
!/usr/bin/perl -Tw
use strict;
$|=1;
use FileHandle;
use IPC::Open2;
my ($rdr,$wtr) = FileHandle::pipe;
BEGIN{$ENV{PATH}='/home/quake/bin/'}
my $pid = open2($rdr,$wtr,'squake -dedicated 2 -udpport 26200');
# Unbuffer everything every way I know how.
$rdr->autoflush();
$wtr->autoflush();
autoflush STDOUT 1;
autoflush $rdr 1;
autoflush $wtr 1;
print 'reading...';
while(<$rdr>){
print STDOUT "Qscan: $_";
}
------------------------------
Date: 2 Feb 1998 00:39:22 -0500
From: David Adler <dha@panix.com>
Subject: Re: boston.pm.org
Message-Id: <vx990rupnuf.fsf@panix.com>
pudge@pobox.com (Chris Nandor) writes:
> sub hockey {
> return "the Boston Bruins beat up on the NY Rangers yesterday :)"
> }
Hmm... methinks the ny.pm module may just have to add C<sub
bite_me>. :-)
But seriously folks, best wishes on boston.pm!
--
David H. Adler - <dha@panix.com>
Still workin' on that JANYPH...
------------------------------
Date: Mon, 02 Feb 1998 02:41:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: dc.pm.org
Message-Id: <comdog-ya02408000R0202980241260001@news.panix.com>
Keywords: from just another new york perl hacker
[ just how many flesh eating vultures have to call long distance to
dial in to Panix? ]
In article <6at1nu$h4t@panix.com>, hood@panix.com (Philip Hood) posted:
>#################################################################
>d c . p m . o r g
>#################################################################
>
>If New York has and LA and Boston are gonna have
>organized perl'ers, DC needs to have some as well!
for users groups that wish to be associated with Perl Mongers (thus
using a sub-domain .pm.org), please contact me directly and we'll
work out the nameserver details. i'll also arrange to have the group
listed in the upcoming pm.org web thingy.
for those unfamiliar with Perl Mongers, it is an organization that
i started at the last Perl Conference. its sole purpose is to assist
the formation of Perl users groups. although the details of the
organization have not been made public, we are working with The Perl
Institute et alia to make this happen.
around the middle of february (when my T1 is installed) there will be
web stuff at pm.org that tells more about Perl Mongers, as well as
listing the local .pm groups. one of our first projects is going to be
t-shirt sales - Perl Mongers will design and pay for lots and lots of
shirts and will then sell them to local user groups.
The user group can then sell the shirts for even more to get some initial
cash. since Perl Mongers will be buying these in very large quantities,
the price will be much lower than a small group can get.
again, if you are interested in this sort of thing, contact me
directly, since i won't necessarily be here to see the followups (unless
dha tells me to come here to see something :)
--
brian d foy <comdog@computerdog.com>
NY.pm - the New York City Perl Mongers <URL:http://ny.pm.org>
style guide <URL:http://computerdog.com/brian/style.html>
------------------------------
Date: Mon, 02 Feb 1998 01:24:04 -0500
From: Chris Heiden <cmheiden@mtu.edu>
Subject: Decent Perl books
Message-Id: <34D56684.960182CF@mtu.edu>
Hello there,
I am new to the Perl community. I was wondering if any of you could
recommend any books as tutorials and reference to Perl. I already have
two from Learning Perl and Learning Perl on Win32 systems from O'reilly
and Associates. I just wanted to see what everyone out there with
actual experience with some books had to say.
Chris
------------------------------
Date: Sun, 01 Feb 1998 22:00:27 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Don't forget the Perl Journal (was Re: Good place to start in Perl 5)
Message-Id: <34D552CB.199E015D@5sigma.com>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, king@cogsci.ucsd.edu (Jonathan King) writes:
> :HOWEVER (and I do mean to shout here), I was really *pissed* at the
> :number of typos and other flaky things [...]
>
> You really don't know how hard it is. That's all I can say.
For once we are in complete agreement :-)
-joseph
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: Fri, 30 Jan 1998 16:28:03 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
To: Anthony Boyd <anthony@outshine.com>
Subject: Re: Forcing 7-digit number?
Message-Id: <Pine.OSF.3.95.980130162700.6703H-100000@primal.ucdavis.edu>
Emailed to author and posted!
On 31 Jan 1998, Anthony Boyd wrote:
> Programming Perl says on p 222 that printf should give me padding with
> zeros for numbers. I think my shortcoming is not understanding the
> various format options -- perhaps %7d is incorrect? Perhaps I need to
> convert from a scalar, which might be interpreted as a string?
man sprintf
!
---------------------------------------------------------------------------
Jason Christian University of California, Davis
jason@primal.ucdavis.edu Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614 Davis, CA 95616
------------------------------
Date: Sun, 01 Feb 1998 23:21:13 -0500
From: Kevin Scott <scottj@mthcsc.wfu.edu>
Subject: Re: Generating the partitions of a string
Message-Id: <34D549B9.B72F5725@mthcsc.wfu.edu>
David Fetter wrote:
[snip]
> Slup in a string, and generate all of its partitions, so 'word'
> generates the array:
>
> ['word'],
> ['wor','d'],
> ['wo','rd'],
> ['wo','r','d'],
> ['w','ord'],
> ['w','or','d'],
> ['w','o','rd'],
> ['w','o','r','d']
[snip]
You can always generate the partitions of a word recursively. One way
to do this is with the following Perl:
sub partition {
my($w) = pop(@_);
my(@partitions,@tpartitions,@parts,$partition);
if ( length($w) <= 1 ) {
push(@partitions,$w);
return @partitions;
} else {
@tpartitions = partition(substr($w,1));
$tc = substr($w,0,1);
foreach $partition (@tpartitions) {
@parts = split(/:/,$partition);
push(@partitions,join(':',$tc,@parts));
push(@partitions,join(':',$tc.shift(@parts),@parts));
}
return @partitions;
}
}
@p = partition('word');
print "@p\n";
--End of example---
A partition of a word is represented as a string with the parts
separated by a ':'. I did this mainly for clarity. Someone else may
know of a readable way to do this with arrays which would perhaps save
you the cost of the split / join in the foreach loop.
Happy partitioning.
--
****** Kevin Scott
******* Department of Mathematics & Computer Science
******** Wake Forest University
******* scottj@mthcsc.wfu.edu
------------------------------
Date: 1 Feb 1998 19:50:01 -0700
From: lgstarr@primenet.com (Linda Starr)
Subject: Help: Testing a CGI script locally/Path to browser
Message-Id: <lgstarr-0102981849470001@ip34-218.bur.primenet.com>
What is the path (action = "......../cgi-bin/mydoc.pl") to the browser if
I am testing CGI scripts locally in WIN 95 and a Mac
------------------------------
Date: Mon, 02 Feb 1998 14:20:07 +1100
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: How to write fixed format data?
Message-Id: <34D53B67.EC7BC6ED@spider.herston.uq.edu.au>
Printf pops up again and again in the perl docs (must be a useful
routine). However, Win32 users don't necessarily have documentation for
printf formats. There's nothing in the perl docs or the FAQs.
Searching the net for "+printf +formats" reveals an immense number of
GAWK manuals, as well as the following printf man page:
http://www.neosoft.com/neosoft/man/printf.1.html
However, I don't know enough about Unix to know whether this is *the*
printf definition or one of many.
Arguing on the premises that: you can install a perl executable without
any C libraries other than those already linked in; you can run perl on
non-Unix systems; printf is a core perl function; all this is a good
thing;
I'd say that references in the perl docs and the camel to documentation
that is non-existent on something like 50% of perl installations does
nothing to enhance cross-platform appeal.
--
Jaime Metcher
Tad McClellan wrote:
>
> Pascal Houde (houde@fox.cisti.nrc.ca) wrote:
> : I'm currently using the format function to set a fixed record.
> : So it looks like:
> : format my_record =
> : @<<<<<<@<<@<<<< etc...
> : $field1,$field2,$field3, etc...
>
> : The problem is that my fixed record is over 1000 chars long!
> : Some fields are 200 long. So you imagine the number of <<< I have!
> : Is there any other way to set a fixed record in a simpler way?
>
> printf() instead of format maybe?
>
------------------------------
Date: Mon, 2 Feb 1998 00:10:16 -0500
From: RAYMOND CHEONG <r_cheon@alcor.concordia.ca>
To: Mark-Jason Dominus <mjd@plover.com>
Subject: Re: New Perl-Oriented Web Site has materials not available elsewhere
Message-Id: <Pine.OSF.3.96.980202000931.21138A-100000@alcor.concordia.ca>
Are you sure the following URL is right??? 'cos I couldn't get thru...
Ray
On 22 Jan 1998, Mark-Jason Dominus wrote:
>
> My Perl Paraphernalia web site, at
>
> <URL:http://www.perl.com/~mjd/perl>
>
> has items that may be of interest to Perl programmers. These items
> include my published and unpublished articles about Perl, surprising
> and bizarre Perl software, and other oddments. More items are likely
> to appear in the near future.
>
> Complete list of materials presently available:
>
> * Perl Journal Articles
> o Infinite Lists
> o B-Trees
> o (New article coming soon)
>
> * Other Articles
> o IEEE Software
>
> * Why Questions go Unanswered
>
> * When Hashes Go Wrong
>
> * Perl Oddity: A program that writes parser programs
> in Perl (coming soon)
>
> * Read a description of the 1967 edition of Perl!
>
> * Possibly the stupidest Perl program ever written.
>
>
> <URL:http://www.perl.com/~mjd/perl>
>
> Mark-Jason Dominus mjd@plover.com
>
>
>
>
If there was any other way...
Don't you think I've tried to find it...
------------------------------
Date: Mon, 02 Feb 1998 02:44:41 GMT
From: cdog@ubetcha.com (cdog)
Subject: pst
Message-Id: <34d5360c.0@news.badger1.net>
pst
------------------------------
Date: 01 Feb 1998 23:53:54 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Re: Public Response to Private Flame (albeit machine-generated)
Message-Id: <omafcacxa5.fsf@tees.cs.ualberta.ca>
In article <MPG.f3de409f609437b9896b2@news.concentric.net> jdf@pobox.com (Jonathan Feinberg) writes:
> Tom Christiansen bought Perl from Larry Wall in a shocking hostile
> takeover. He immediately laid off Randal Schwartz and put Tom
> Phoenix in the mailroom, out of harm's way.
You're mistaken about Phoenix, Jonathan. Actually Christiansen gave
him this important and lucrative position, all because they're
namesakes. :)
> Have I been superbly trolled?
Never attribute higher purpose to something that can easily be
explained by stupidity :)
------------------------------
Date: 02 Feb 1998 12:08:34 +1100
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: Public Response to Private Flame (albeit machine-generated)
Message-Id: <yeolnvuolt9.fsf@kudu.ind.tansu.com.au>
Rich Grise <lovegod@earthling.net> writes:
> Before I go rage on this "tchrist" guy (what does "tchrist" stand for,
> after all, "The Christ??" who in The World does this guy think he is?
I think Rich has shown himself to be the an-tchrist (AntiChrist) :)
I guess it was only a matter of time before he showed up on our newsgroup.
Whoops!- I mean showed up on comp.lang.perl.misc newsgroup. Who do I
think I am?- claming part-ownership of the newsgroup.
> our questions such that he has a F???ING AUTOMATIC RESPONDER
> FLAME questions that we sent to his oh-so-ivory-tower personal
> mailer, maybe we should just quit listening to his gold-plated
> ass?
Well, I like reading his stuff if only for the Unix/Larry Wall quotes.
(although a recent thread shows us where we can get our own Larry quotes).
The my() vs local() thing was quite handy too.
So I'll keep reading him, thanks for the suggestion anyway.
> OK, so I'm not a big high-buck owner of some website, you ivory-tower
> types are all the same - climb up on the backs of your co-learners, and
> "ooh, I've got mine now, time to pull up the drawbridge!"
Yeah, that old information-hoarding, unhelpful, selfish tchrist.
Rich may prefer that comp.lang.perl.misc was a moderated newsgroup,
or, by the tone of his message, an immoderate newsgroup.
Meanwhile for people seeking good word-wrapped news systems; use Emacs
on Unix. For people seeking a good Perl editor; use Emacs on Unix.
For people seeking...
Stuart Cooper
stuartc@ind.tansu.com.au
(stuartc- get it? stuart + c[ooper] = stuartc)
------------------------------
Date: Sun, 01 Feb 1998 20:56:44 -0500
From: Bruce Hodo <bruceh@interaccess.com>
Subject: s/// Usage Problems
Message-Id: <34D527DB.DAE81E33@interaccess.com>
I'm guessing that I'm not doing something properly, but I can't figure
out what. Here is my code:
$query = new CGI('');
@record = split(/;/,$record);
foreach (@javadbfieldname) {
my $field = shift(@record);
$field =~ s/'/\'/g;
my $paramset = '$query->param(-'."$_=>'$field')";
eval $paramset;
}
As you can see, I'm using CGI.pm. However, I am using it to create html
pages, and not to process forms. What I'm trying to do is read in a
record containing info for a page, parse it into a new query, and then
use the $query->param() syntax to process it. My problem is that
sometimes a field contains a paragraph containing single quotes. Since
the syntax uses single quotes to delimit parameter, I need to escape
them inside the string. Hence the use of s///. But, for some reason the
substitution does not occur until the >my $paramset =
'$query->param(-'."$_=>'$field')";< statement. I've poured over the
camel and llama books (first edition), as well as any online docs I can
find, with no success. Can someone tell me what I'm doing wrong?
P.S. I know I shouldn't "eval" inside a loop, but the value changes with
each field processed.
Thanks in advance!
--
Bruce Hodo - Webmaster, GetAwayNetwork, Inc.
==Providing unique vacation information on the World Wide Web==
For Villas, Resorts, Hotels, Air/Hotel Packages, Charter Airfares
And Now Offering Travel Auctions!
=============== Visit us at http://getawaynet.com ===============
------------------------------
Date: 2 Feb 1998 03:56:34 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: summary: speed comparision of 5 perl programs emulating "tail"
Message-Id: <6b3g5i$6qv$1@news.ml.com>
The following is the timing of running five different
perl scripts emulating of "tail".
for i in 0 1 2 3 4
do
echo mi_tail$i.pl
time perl mi_tail$i.pl -10 2.2 > /dev/null
done
wc 2.2
197598 959692 12250902 2.2
mi_tail0.pl
real 4m2.33s
user 0m4.28s
sys 0m7.03s
mi_tail1.pl
real 0m14.41s
user 0m8.53s
sys 0m0.82s
mi_tail2.pl
real 0m10.99s
user 0m8.83s
sys 0m0.69s
mi_tail3.pl
real 0m0.91s
user 0m0.28s
sys 0m0.11s
mi_tail4.pl
real 0m0.21s
user 0m0.02s
sys 0m0.06s
mi_tail0.pl: #/* The problem with this script: it loads all lines
# in memory and hence very slow */
#!/usr/local/bin/perl -w
#/* Craig Berry - cberry@cinenet.net */
use strict;
my $numLines = 10;
if (@ARGV > 0 && $ARGV[0] =~ /^-(\d+)/) {
shift @ARGV;
$numLines = $1;
}
my @lines = <>;
print @lines[-$numLines .. -1];
mi_tail1.pl: #/* this script does line by line */
#!/usr/local/bin/perl
#/* Earl Hood (ehood@medusa.acs.uci.edu) */
my $n = 10;
if ($ARGV[0] =~ /^-(\d+)$/) {
$n = $1;
shift @ARGV;
}
my @lines = ();
while (<>) {
push @lines, $_;
shift @lines if (@lines > $n);
}
print @lines;
mi_tail2.pl: #/* this script improve mi_tail1.pl a bit by
# throwing out $maxlines lines once @lines
# accumulated 2*$maxlines lines. */
#!/usr/local/bin/perl
#/* markm@nortel.ca / al278@freenet.carleton.ca */
my $maxlines = 10;
if ($ARGV[0] =~ /^-(\d+)$/) {
$maxlines = $1;
shift @ARGV;
}
my @lines = ();
while (<>) {
push(@lines, $_);
splice(@lines, 0, $maxlines) if @lines >= (2 * $maxlines);
}
splice(@lines, 0, @lines - $maxlines) if @lines > $maxlines;
print @lines;
mi_tail3.pl: #/* this is the best perl emulation of "tail" that
# I can think of. It almost maps the tail.c program
# byte by byte. */
#!/usr/local/bin/perl -w
use strict;
use FileHandle;
my $fh;
my $buf_scalar;
my @buf;
my $buf_size = 1024;
my $cur_buf_size;
my $end_pos;
my $cur_pos;
my $st_pos;
my $nline = 10;
my $nread;
my $nb;
my $nl=0;
my $SEEK_SET=0;
my $SEEK_CUR=1;
my $SEEK_END=2;
if (@ARGV > 0 && $ARGV[0] =~ /^-(\d+)/) {
$nline = $1;
shift @ARGV;
}
my $file=shift;
$fh = new FileHandle "$file", "r";
seek $fh, 0, 2;
$end_pos = tell $fh;
for ($cur_pos = $end_pos - $buf_size;
$cur_pos != -$buf_size;
$cur_pos -= $buf_size) {
$cur_buf_size = $buf_size;
if ($cur_pos < 0) {
$cur_buf_size = $buf_size + $cur_pos;
$cur_pos = 0;
}
seek $fh, $cur_pos, $SEEK_SET;
$nread = read $fh, $buf_scalar, $cur_buf_size;
@buf = split //, $buf_scalar;
for ( $nb = $nread - 1; $nb >= 0; $nb-- ) {
if ( $buf[$nb] eq "\n" ) {
$nl++;
if ( $nl == $nline + 1 ) {
$st_pos = $cur_pos + $nb + 1;
$nb = -1;
$cur_pos = 0;
}
}
}
}
for ($cur_pos = $st_pos; $cur_pos < $end_pos; $cur_pos += $buf_size) {
seek $fh, $cur_pos, $SEEK_SET;
$nread = read $fh, $buf_scalar, $buf_size;
print $buf_scalar;
}
mi_tail4.pl: #/* this simply calls the C program */
#!/usr/local/bin/perl
my $n=10;
if ($ARGV[0] =~ /^-(\d+)$/) {
$n = $1;
shift;
}
my $file=shift;
system "/usr/local/bin/tail -$n $file";
------------------------------
Date: 2 Feb 1998 05:11:01 GMT
From: Zenin <zenin@best.com>
Subject: Re: Survival Of perl
Message-Id: <886396551.503217@thrush.omix.com>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: In comp.lang.perl.misc, lovegod@earthling.net writes:
: :the only computer I could find
: :with web (or "net") access for less than $20,000.00 came with w95.
: Linux is free.
And if one _had_ to actually pay for the OS, both Sun and SGI
make pretty meen boxes for not much more then a high end PC.
But then you'd have to work with IRIX <shutters> or Solaris...
--
-Zenin
zenin@best.com
------------------------------
Date: Sun, 01 Feb 1998 19:57:07 -0800
From: Paul Banks <pbanks@ix.netcom.com>
Subject: Unpack float
Message-Id: <34D54413.8126EF48@ix.netcom.com>
I need to unpack a struct which contains float data.
I can unpack the int, long & short, but float gives me some really weird
results. I have read the section that says it can't be done, but that
was last week.
Does anyone have a solution other than writing a small c program to
convert the entire struct to character data via fprintf?
Thanks
Paul Banks
pbanks@ix.netcom.com
------------------------------
Date: 01 Feb 1998 22:27:39 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: andrew.spiers@virgin.net
Subject: Re: Using -w
Message-Id: <omd8h6d19x.fsf@tees.cs.ualberta.ca>
What version of CGI.pm do you use? Perhaps a newer version fixes
these. I don't get them in a script using -w and CGI 2.36.
------------------------------
Date: Sun, 01 Feb 1998 23:25:37 -0400
From: Webmaster Of Jonspage <jonspage@geocities.com>
Subject: When was perl created?
Message-Id: <34D53CB1.E57584DC@geocities.com>
Hi,
I'm doing a project on different programming languages and I want to do
a time line of the languages...so does anyone know when perl was
created?
Thanks,
--
JJJJJJJJJJ OOOOOOOOO NNNNNN NNN
JJJJJJJJJJ OOOOOOOOOOO NNNNNNN NNN
JJ OOO OOO NNN NNN NNN
JJ OOO OOO NNN NNN NNN
JJ OOOOOOOOOOO NNN NNNNNN
JJJJJJ OOOOOOOOO NNN NNNNN
Homepage: http://www.jonspage.home.ml.org
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1785
**************************************