[8803] in Perl-Users-Digest
Perl-Users Digest, Issue: 2420 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 26 11:17:28 1998
Date: Sun, 26 Apr 98 08:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 26 Apr 1998 Volume: 8 Number: 2420
Today's topics:
Re: == vs. eq (Hendrik Mans)
Appending Lines 1&2, 3&4, ETC., <sysop@dsrt.com>
Re: best way to find disk space for a directory <jll@skynet.be>
books for learning perl <jkbass@netnet.net>
Re: books for learning perl <daniel@nospamstridhammar.pp.se>
Changing @INC <grimes@msn.com>
Re: commenting a whole block? (Stefan Berglund)
File matching, file handle and defined(<...>) problems (Michael Haertfelder)
Re: File matching, file handle and defined(<...>) probl <jdf@pobox.com>
Re: HELP!! Very Strange - Sprite.pm problem accessing d (Shishir Gundavaram)
Re: How to read command line literally? (Stefaan A Eeckels)
http Reg Exp <archive@cglis.com>
Image can view but cannot SAVE? (LM386)
Opening a TCP connection <timjudd@teleport.com>
Re: Opening a TCP connection (Jonathan Stowe)
Re: perl 5.004 is better than 5.004004 ?! <captain@pirate.de.nospam-delete-this>
Re: perl 5.004 is better than 5.004004 ?! (Knut Stolze)
Perl version for HP9000 series 382...Info Please <rkopalle@intel7.intel.com>
Re: Perl-only distribution (was Re: How do I build Linu <lamber45@EGR.msu.edu>
Re: Perl-only distribution (was Re: How do I build Linu <jdf@pobox.com>
perl/gtk - any such thing? <buck88@execpc.com>
QUESTION: How do I print file contents to screen? <djoyce@netunlimited.net>
Re: RFI: Counting repeated substrings within a string <rjk@coos.dartmouth.edu>
Re: RFI: Counting repeated substrings within a string (Andre L.)
Re: Shopping Cart in Perl (Henning Petersen)
Re: Why doesn't this work? <uri@sysarch.com>
writing to file on site <flanker@sonnet.ru>
Re: writing to file on site <tchrist@mox.perl.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Apr 1998 11:45:44 GMT
From: morn@unreal.org (Hendrik Mans)
Subject: Re: == vs. eq
Message-Id: <slrn6k6i4n.ld.morn@hackfried.unreal.org>
On Sat, 25 Apr 1998 16:35:06 -0400, Kelby Valenti <kelby@mplx.com> wrote:
>What exactly is the difference between == and eq in an if statement. Also
>is there a function that can tell me whether a string is numbers or chars.
>Thanks, Kelby
As far as I know (and I'm still a PERL newbie), the == is used for
numerical comparisons while "eq" is used for string comparisons.
Take care,
Hendrik
--
Hendrik Mans aka Morn <morn@unreal.org>
system gimp, php monkey and irc m0m0 @ The ORG - http://unreal.org
morn @ irc.gameslink.net (#unreal, #staff) "Moo." - a cow
------------------------------
Date: Sun, 26 Apr 1998 04:43:33 -0600
From: Michael Gray <sysop@dsrt.com>
Subject: Appending Lines 1&2, 3&4, ETC.,
Message-Id: <35430FD5.4C89@dsrt.com>
HI,
I'm using shell scripts, to manipulate the output of "radiusreport", and
I'm pretty happy, so far. Except one "simple" task. I need to take
lines one and two, three and four, etc,... and print line 1 and line 2,
on one line, then line 3 and line 4 on the next line, up to "x" number
of lines, depending on the number of active users. I tried "chop" and
it works for the first USER, but doesn't for the rest. Is there a way
to set ut an array delineated by skipping line numbers instead of
fields?
Please reply via e-mail....... sysop@dsrt.com
Much thanks for your help!
Mike, an ISP in New Mexico....sysop@dsrt.com
------------------------------
Date: Sun, 26 Apr 1998 10:05:09 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: best way to find disk space for a directory
Message-Id: <VA.00000031.000ddc3a@enterprise>
I have written a small utility that lists all the files in a directory
(and in its subdirs) and displays them, ordered by decreasing size, on
teh console or in a Tk listbox (that lets you remove the files). I can
post it here if anybody's interested.
It uses File::Find to, well, find the files, -s to get the size and -f
to skip non-'normal' files.
Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/
------------------------------
Date: Sat, 25 Apr 1998 02:24:58 +0000
From: jason bass <jkbass@netnet.net>
Subject: books for learning perl
Message-Id: <3541497A.482B27C6@netnet.net>
hello i'm new to perl and i would like to know if there are any good
books for learning perl
i already have perl 5 for dummies but it seems the author wrote the book
for people that
are already familier with other programming languages.
please help i want to learn so bad, it seems so interesting.
thanks
jason
------------------------------
Date: Sun, 26 Apr 1998 12:28:59 +0200
From: Daniel Stridhammar <daniel@nospamstridhammar.pp.se>
Subject: Re: books for learning perl
Message-Id: <35430C6B.7B641C7E@nospamstridhammar.pp.se>
I can recommend 'Learning Perl' from O Reilly for learning Perl. As a
reference 'Programming Perl' will work fine (also from O Reilly) as well as
going further after have reading 'Learning Perl'.
If you're looking for books covering CGI programming, check out 'CGI
Programming on the world wide web' (O Reilly again...) and CGI/Perl
Cookbook (from Wiley) by Matt Wright and Craig Patchett.
'CGI programming' feels sometimes a bit old and contains some examples
that's probably not particular close to what you're looking for. However, it
have important areas for the CGI programmer.
CGI/Perl cookbook explains, for the newbie, many enigmatic things. This book
explains by heavily commented examples.
None of the CGI books fits very well for the complete newbie. In such a case
I recommend to start with 'Learning Perl'.
All books can be found at: http://www.amazon.com
Good luck :-)
Daniel
> hello i'm new to perl and i would like to know if there are any good
> books for learning perl
> i already have perl 5 for dummies but it seems the author wrote the book
> for people that
> are already familier with other programming languages.
> please help i want to learn so bad, it seems so interesting.
> thanks
> jason
------------------------------
Date: Sun, 26 Apr 1998 00:31:42 -0700
From: "Grimes" <grimes@msn.com>
Subject: Changing @INC
Message-Id: <6huob9$t13$1@nntp2.ba.best.com>
How do I change the default @INC list of paths?
I'm running Win32 Perl 5.004. I've searched through the installed files to
see where this is set up but cannot find it. I've also searched registry
keys, INI files, etc.
Fergal
------------------------------
Date: 26 Apr 1998 09:37:18 GMT
From: f94stbe@dd.chalmers.se (Stefan Berglund)
Subject: Re: commenting a whole block?
Message-Id: <6huv8e$6hh$1@eol.dd.chalmers.se>
In article <6htj2e$ktm$1@pulp.ucs.ualberta.ca>, michal@gortel.phys.ualberta.ca (Michal Jaegermann) writes:
> Stefan Berglund (f94stbe@dd.chalmers.se) wrote:
>: press s/^/# / and press return. Finished!
>
> Oh, I would love to see that "s/^/# /" keypress (said typing that in
:-)
> vim; but for a real work I use a real editor :-).
I can even do better:
_type_
:map g :s/^/# / <return>
then comment the region would be done as
mark region
g
Was someone speaking of a real editor, I wonder what that would be?
And the Holy War continues.
Nuff said.
Let's keep the rest of the posts about perl.
--
/Stefan
f94stbe@dd.chalmers.se
Life - the ultimate practical joke
finger f94stbe.pgp@dd.chalmers.se for public pgp-key
------------------------------
Date: 26 Apr 1998 13:04:00 +0200
From: haert@wharp.rhein-main.de (Michael Haertfelder)
Subject: File matching, file handle and defined(<...>) problems
Message-Id: <6sc2nFoFZZB@wharp.rhein-main.de>
1.) SUppose we have:
$dir1 = "C:\tmp";
$dir2 = "C:\data";
$dirflag = 1;
...
foreach $workfile (<(($dirflag) ? $dir1 : $dir2)/*.dat>) {
print "$workfile\n";
}
doesn't work. If I remove the conditional expression (x)?y:z
and fill in either $dir1 or $dir2 alone it works (Some files are existing
which match the condition). Why ?
I experimented also with
(<($dirflag) ? $dir1 : $dir2/*.dat>)
or
(<"($dirflag) ? $dir1 : $dir2"/*.dat>)
Any suggestions ?
2.) I had to recognize that FILEHANDLES created during an open statement
are local to a subroutine only. Are there any possibilities to make them
global or pass them via a parameter ?
The following doesn't work:
sub xxxx {
....
open(FILEHAND,"C:\tmp\a.dat");
print FILEHAND "this works\n";
&yyyy(FILEHAND);
....
close (FILEHAND); }
sub yyyy {
print @_[0] "phrase from yyyy doesn't work\n";
}
3.) What's the advantage of using
while (defined($linein = <FILEHAND>)) { ... } vs.
while ($linein = <FILEHAND>) { .... }
Thanx in advance
Michael
------------- Michael Haertfelder Frankfurt/Main, Germany ----------------
------------- http://odb.rhein-main.de/people/haertfelder/ ----------------
------------------------------
Date: 26 Apr 1998 09:09:42 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: haert@wharp.rhein-main.de (Michael Haertfelder)
Subject: Re: File matching, file handle and defined(<...>) problems
Message-Id: <67jw4qu1.fsf@mailhost.panix.com>
[posted and mailed]
haert@wharp.rhein-main.de (Michael Haertfelder) writes:
> 1.) SUppose we have:
>
> $dir1 = "C:\tmp";
I doubt you have a file with the tab character in its name. You'll do
better with "C:/tmp" (which works fine on Win32) or 'C:\tmp' which
doesn't interpolate. I'd use 'C:/tmp', since I only use double-quotes
when I specifically need to interpolate.
> (<($dirflag) ? $dir1 : $dir2/*.dat>)
^
You're not building valid Perl syntax, here
I'd suggest using the glob builtin explicitly or using
opendir/readdir.
@files = glob ($dirflag ? $dir1 : $dir2) . '/*.dat';
or (better, IMHO)
opendir SOMEDIR, ($dirflag ? $dir1 : $dir2) or die "$!";
@files = grep { /\.dat$/ } readdir SOMEDIR;
closedir SOMEDIR;
> 2.) I had to recognize that FILEHANDLES created during an open
> statement are local to a subroutine only. Are there any
> possibilities to make them global or pass them via a parameter ?
You'll need to do some reading: please see perldata in the section
titled "Typeglobs and Filehandles," perlsub under "Pass By Reference."
In general you pass a reference to the filehandles typeglob, like so:
&func(\*HANDLE);
You should look into the IO::Handle module.
> 3.) What's the advantage of using
>
> while (defined($linein = <FILEHAND>)) { ... } vs.
> while ($linein = <FILEHAND>) { .... }
In the rare occasion of the last line of the file having nothing but
zero(s) and no carriage return, the second form will evaluate to
false, and you'll never see that line.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 26 Apr 1998 05:50:41 GMT
From: shishir@ruby.ora.com (Shishir Gundavaram)
Subject: Re: HELP!! Very Strange - Sprite.pm problem accessing database
Message-Id: <6huhvh$2va$1@amber.ora.com>
Anthony Owen Brinson (abrinson@indiana.edu) wrote:
: This uses the same variable name as the select, and the syntax for the
: update is copied from the all.pl file from the example that comes with
: Sprite 3.2.
[deleted]
: $rdb->sql (<<EOU) || print"<B>Update failed</B><BR><BR>\n";
:
: update $CompanyDB
: set $UpdateData
: where (Rep_E-Mail =~ /$Email/)
^
|
There's your problem. Looking at the docs, I seem to have forgotten to
mention that the only characters allowed for column names are:
[A-Za-z\x80-\xFF] ## A-Z, a-z and \x80 .. \xFF
This will be fixed in the next release.
--Shishir
------------------------------
Date: 26 Apr 1998 10:29:50 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: How to read command line literally?
Message-Id: <6hv2au$2uu$1@justus.ecc.lu>
In article <6hr1j8$brt$4@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
> In comp.lang.perl.misc,
> tendus@rpi.edu (Saurabh S. Tendulkar) writes:
>:I am new to Perl. I want to read the command line literally.
>:For example, if I say
>:
>:perlprog *.txt
>:
>:ARGV expands into all the .txt files. I want $ARGV[0] =
>:"*.txt". How can I do that ?
>
> You call it as
>
> $ perlprog '*.txt'
>
> of course. Any real shell preglobs for you so you don't
> have idiotic applications with varying behaviours.
>
>:I preferably dont want to change the command line in any way.
>
> Then you lose. May I interest you in a CP/M system instead?
Hey, we don't have to go _that_ far back - I've got an old
286 Saurabh can have for free. It has MS-DOS 7.0 on it and
guess what? It doesn't do any globbing. Come to think of it,
my NT4.0 command interpreter (if one can call it that) doesn't
do any globbing either ;-)
NT even has CP/m (notice the _m_)'s concept of drives:
C:>\
CP/m is here to stay - in fact, several large companies are
currently downgrading to it.
Who was it who said: 'we learn from history that we learn
nothing from history'? It wasn't Mr G Gates, Esq. was it?
--
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
"Don't worry about people stealing your ideas. If your ideas
are any good, you'll have to ram them down people's throats."
-- Howard Aiken
------------------------------
Date: Sun, 26 Apr 1998 10:38:40 -0400
From: Chris Lambrou <archive@cglis.com>
Subject: http Reg Exp
Message-Id: <354346F0.CCC9CA0@cglis.com>
Hello,
I'm writting a Perl based web interface for reading/sending email.
I'm looking for a reg ex that will covert any http references
such as:
http://www.some_domain.com
To the HTML equivalent of :
<a href="http://www.some_domain.com">http://www.some_domain.com</a>
so that the reader of the email messgae can just jump to the URL within
the browser. This is what I came up with (assuming $msg to be the body
of the email
message):
$msg =~ s!(ftp|https?)://([^\s]+)!<a href="$1://$2">$1://$2<\/a>!gsi;
90% this works. The problem is that the above will match text that
starts with
ftp/http/https followed by :// up to the next white space character,
so this breaks down if the URL is followed by a non word character such
as comma, a ">" or something else.
Any ideas how to fix it?
Thanks in advance.
------------------------------
Date: Sun, 26 Apr 1998 09:24:02 GMT
From: stevenchan69@hotmail.com (LM386)
Subject: Image can view but cannot SAVE?
Message-Id: <3542fc5a.3951113@news3.newscene.com>
***sorry for the last question make confuse
My question is:
Image can view but cannot be saved by right click of the mouse in the
www browser?
how is the technique to make it possible?
i find that there are some site on the net using this technology,
they are put the image to the client side by CGI script,
but it is very mystery to me,
the WWW browser should only receive the right content-type header to
display the image correctly,
if the WWW browser know the content-type is image,
it should be saved thought the right click mouse button,
so...
how do those people make this real?!
pls tell me
very thanks!!!
------------------------------
Date: Sun, 26 Apr 1998 08:42:39 GMT
From: PwrSurge <timjudd@teleport.com>
Subject: Opening a TCP connection
Message-Id: <Pine.GSO.3.96.980426004042.28023A-100000@user1.teleport.com>
*HELP*
I've looked everywhere, asked everybody except everybody here, and the
people that I have asked gave me the brush-off.
I need to know how to open a TCP connection over the internet. I can
either use UNIX's perl5.x or MacPerl V4.1.8 (MAX) to create the script.
I've searched the camel and the llama book and with no avail, I can't get
anything accomplished.
What I need done is the following:
OPEN a TCP connection to one of the servers (SMTP, NTTP, WWW, etc) on my
local ISP, then allow reading/posting to the servers. The scripting for
the reading/posting I'd like to do as an excersize, but the TCP connection
is NEEDED.. I can't figure it out.
WOULD it be possible to get somebody to make one for me, and send it via
email to timjudd@teleport.com?
I would appreciate it, and it will be credited toward you each time the
program is run. I appreciate your time and help
-Tim
(P.S. Thanks In Advance)
+----------------------+-----------------------------------+
| timjudd@teleport.com | HTTP://www.teleport.com/~timjudd/ |
| tjudd@pacifier.com | HTTP://www.pacifier.com/~tjudd/ |
| PwrSurge@rotfl.com |HTTP://members.rotfl.com/~PwrSurge/|
+----------------------+-----------------------------------+
------------------------------
Date: Sat, 25 Apr 1998 18:57:18 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Opening a TCP connection
Message-Id: <35422c68.2735374@news.btinternet.com>
On Sun, 26 Apr 1998 08:42:39 GMT, PwrSurge wrote :
>*HELP*
>
Dont shout I've got a headache.
>I've looked everywhere, asked everybody except everybody here, and the
>people that I have asked gave me the brush-off.
>
Thats life, I suppose.
>I need to know how to open a TCP connection over the internet. I can
>either use UNIX's perl5.x or MacPerl V4.1.8 (MAX) to create the script.
>I've searched the camel and the llama book and with no avail, I can't get
>anything accomplished.
>
A closer examination of chapter 7 of the Camel (blue) would probably
help: the keyword here is "Socket". The pink Camel has an example
sockets client if you can lay your hands on a copy (actually I think
the example is the same as the one found in the eg/ directory of the
distribution).
>What I need done is the following:
>
> OPEN a TCP connection to one of the servers (SMTP, NTTP, WWW, etc) on my
>local ISP, then allow reading/posting to the servers. The scripting for
>the reading/posting I'd like to do as an excersize, but the TCP connection
>is NEEDED.. I can't figure it out.
>
Perlfaq5 has an example based on IO::Socket which you may find useful.
However there are a number of modules dealing with these various
protocols available from CPAN Some of which are unsurprisingly called
NET::<something or other>. LWP is the one of choice for WWW.
> WOULD it be possible to get somebody to make one for me, and send it via
>email to timjudd@teleport.com?
>
Nah, its sunday and I want to go to the pub. Anyhow most of the work
has already been done as an exploration of CPAN(1) will show.
>I would appreciate it, and it will be credited toward you each time the
>program is run. I appreciate your time and help
>
My private consulting rates are five pints of ale an hour for
businesses. Two for individuals. Heavenly reward stuff by
negociation ;-}
(1) CPAN = http://www.perl.com/CPAN
/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
------------------------------
Date: Sun, 26 Apr 1998 16:11:27 +0200
From: Mark Seuffert <captain@pirate.de.nospam-delete-this>
Subject: Re: perl 5.004 is better than 5.004004 ?!
Message-Id: <3543408F.74B0@pirate.de.nospam-delete-this>
Jason Gloudon wrote:
> However you didn't say or show the syntax errors so none of the
> above may apply.
actually those errors are just stupid... and the error message and line
number changes every time.
example, this line caused an syntax error:
$IDS{'007'}="moak Moak space.pirate.de 3 1 1009";
I uncomment it, and another stupid error is in a line
before or after.... I tried to compile perl with different settings,
dynamic loading or not and so on.
But now only 5.004 runs the same script without errors! I checked
5.004003 and 5.004004... did not work properly.
--
/Mark (EMailadresse ab ".nospam" lvschen)
http://home.pages.de/~irc ~html ~unix
------------------------------
Date: 26 Apr 1998 14:17:18 GMT
From: stolze@paxp01.mipool.uni-jena.de (Knut Stolze)
Subject: Re: perl 5.004 is better than 5.004004 ?!
Message-Id: <slrn6k6gfd.6jv.stolze@paxp01.mipool.uni-jena.de>
On Sun, 26 Apr 1998 16:11:27 +0200, Mark Seuffert wrote:
> example, this line caused an syntax error:
> $IDS{'007'}="moak Moak space.pirate.de 3 1 1009";
> I uncomment it, and another stupid error is in a line
> before or after....
In welchem Zusammenhang stehen denn die Zeilen ? Es ist stark anzunehmen,
dass davor irgendwo ein Fehler/Unstimmigkeit drin ist, die sich erst spaeter
auswirkt, naemlich an genau dieser Zeile.
Was fuer eine Fehlermeldung wurde genau ausgegeben ?
> --
>
> /Mark (EMailadresse ab ".nospam" lvschen)
> http://home.pages.de/~irc ~html ~unix
Das ist hier uebrigens eine deutsche Newsgruppe. Du musst also nicht
zwingend englisch posten :-))
ciao, Knut
------------------------------
Date: Sun, 26 Apr 1998 05:05:53 -0600
From: Raghu Kopalle <rkopalle@intel7.intel.com>
Subject: Perl version for HP9000 series 382...Info Please
Message-Id: <35431511.6E4E@intel7.intel.com>
Hi,
If anybody knows of a version of perl that works for an
HP9000 series 382 or 380 workstation, I'd really appreciate the
details of getting it. HP 382/380 workstations have been obsoleted
as of Oct 1, 1997 and they use a Motorola 68k processor.
Thanks a lot,
Raghu
(raghu.kopalle@intel.com)
------------------------------
Date: Sun, 26 Apr 1998 02:38:34 -0400
From: David Lee Lambert <lamber45@EGR.msu.edu>
Subject: Re: Perl-only distribution (was Re: How do I build Linux from stratch?? (w/o distribution of course!!))
Message-Id: <Pine.GSO.3.96.980426023235.18747B-100000@area51>
On 26 Apr 1998, Shimpei Yamashita wrote:
> David Lee Lambert <lamber45@EGR.msu.edu> writes:
> >
> >On 20 Apr 1998, Peter Samuelson wrote:
> >
> >> [J. K. Towery <kellyboy@arn.net>]
> >> > *Where* can I get some info on *exactly* which
> >> > files/package/tar-files does Linux needed to get running? I been
> >> > spending all this week searching on Internet, going to bookstore
> >> > (even book from O'Reilly doesnt cover that area), and looking thru
> >> > FTP Archive on CD and find nothing what Im looking for.
> >>
> >> Depends on what you want. The kernel wants to be able to mount a root
> >> directory and run init. Beyond that, whatever init wants to do -- the
> >> kernel doesn't particularly care.
> >
> >How hard would it be to put together a distro that used no shell but
> >/bin/perl? Would it do anything useful?
>
> perl uses tcsh for globbing, so you will have to come up with a
> stripped-down replacement that does csh-style globbing. More
> importantly, libc also calls /bin/sh in several locations (most
> notably in some of the exec() family of calls), so you will also need
> to patch libc. (Does messing around with libc scare you? It should.)
> It isn't as trivial as you might think.
Aren't unexpected calls to sh from obscure places rather the definition of
a security hole? Anyway, messing around with libc doesn't scare me as
long as it's not written in assembler.
Where exactly does perl do globbing?
--
m/lamber45\100(egr|pilot)\.msu\.edu/ and print <<MHM16x20
David Lee Lambert -- Just another perl hacker
webstuph at http://web.egr.msu.edu/~lamber45
MHM16x20
------------------------------
Date: 26 Apr 1998 08:46:36 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Perl-only distribution (was Re: How do I build Linux from stratch?? (w/o distribution of course!!))
Message-Id: <7m4c4rwj.fsf@mailhost.panix.com>
David Lee Lambert <lamber45@EGR.msu.edu> writes:
> Where exactly does perl do globbing?
perldoc -f glob
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Sun, 26 Apr 1998 09:47:49 -0500
From: buck88 <buck88@execpc.com>
Subject: perl/gtk - any such thing?
Message-Id: <6hvgt4$70h@newsops.execpc.com>
Does anyone know if there is anything that allows you to use
the gtk wigit set the way that you can use the tk wigit set?
Not that I have a problem with tk, it was just a curiousity
thing. Also, if anyone could tell me how tcl and perl
compair - as in which one is better for certain things as
compaired to the other (strong points vs. week points). I am
just looking at doing some simple graphic system utilities
(and eventually other things) on linux and was wondering if
I can just use perl, and not have to mess with tcl.
Please e-mail any replys.
Thank you for your help.
--
buck88@execpc.com
http://netnet.net/~vpetinga
------------------------------
Date: Sun, 26 Apr 1998 05:45:11 -0400
From: "David Joyce" <djoyce@netunlimited.net>
Subject: QUESTION: How do I print file contents to screen?
Message-Id: <6huvoq$an4$1@news.netunlimited.net>
How do I print the contents of a file to screen? For instance, I have a
log-file .txt file that I want to print out
to screen, along with any entries I have just appended. Do I use <STDOUT>?
David Joyce
------------------------------
Date: Sun, 26 Apr 1998 02:01:38 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Alfred Landrum <agl3@cornell.edu>
Subject: Re: RFI: Counting repeated substrings within a string
Message-Id: <3542CDC3.834331EE@coos.dartmouth.edu>
[posted and mailed]
Alfred Landrum wrote:
>
> Hi,
>
> I'm working on a cryptology problem. I would like to create
> a perl script that will read in a cyphertext file, and find all
> repeated substrings within that file.
>
> Ex: An input of 'werasdwerasdwer' would return all of the times
> that 'wer', 'era', 'ras', 'asd' occured. (For the assignment, I'm just
> going to be looking at repeated patterns with 4 or more characters, then
> do some frequency study on the results to try and crack the cyphertext.)
How many more characters?
This one does up to the length of the entire string.
for ($pos=0; $pos <= length($_) - 4; ++$pos) {
for ($len=4; $len <= length($_) - $pos; ++$len) {
$substr = substr($_, $pos, $len);
next if exists $freq{$substr};
$freq{$substr} = () = /\Q$substr/g;
}
}
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sun, 26 Apr 1998 02:23:45 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: RFI: Counting repeated substrings within a string
Message-Id: <alecler-2604980223450001@dialup-695.hip.cam.org>
In article <6htts7$6nf@newsstand.cit.cornell.edu>, agl3@cornell.edu
(Alfred Landrum) wrote:
> Hi,
>
> I'm working on a cryptology problem. I would like to create
> a perl script that will read in a cyphertext file, and find all
> repeated substrings within that file.
>
> I have some experience with perl, but so far I have gotten very far.
> If anyone could give me some hints about how to go about this,
> I'd appreciate it.
>
> Ex: An input of 'werasdwerasdwer' would return all of the times
> that 'wer', 'era', 'ras', 'asd' occured. (For the assignment, I'm just
> going to be looking at repeated patterns with 4 or more characters, then
> do some frequency study on the results to try and crack the cyphertext.)
======================
I don't know why I'm doing a student's homework for him, but I couldn't resist.
I'm not claiming this to be the fastest algorithm possible, but it'll get
you started.
-----------------------------
#!/usr/local/bin/perl -w
# Another fine example of Newbieware(TM)
use strict;
my @patterns = ();
my $result = '';
my $s = 'werasdwerasdwerwerasdwerasdwerwerasdwerasdwer';
my $minlen = 2;
my $maxlen = 16;
for (my $patlen = $minlen; $patlen <= $maxlen; $patlen++) {
for (my $i = 0; $i <= length($s)-$patlen; $i++) {
my $ss = substr($s, $i, $patlen);
push (@patterns, $ss) unless grep(/$ss/, @patterns);
}
}
foreach (@patterns) {
$result .= $_.' : '.$s =~ s/$_/$_/g."\n";
}
print $result;
# This hash could be used to analyze the results
# (sort by frequency, etc.):
# my %data = map { $_, $s =~ s/$_/$_/g } @patterns;
__END__
Use this for legal purposes only, eh? :-)
A.L.,
who obviously has no life
------------------------------
Date: Sun, 26 Apr 1998 09:07:46 GMT
From: henning.petersen.nospam.9816@hpc.dk (Henning Petersen)
Subject: Re: Shopping Cart in Perl
Message-Id: <3546f06c.56193822@news.inet.tele.dk>
On Sat, 25 Apr 1998 21:30:18 -0600, tietzmann@yahoo.com wrote:
> I like to implement PerlShop on my web site, but I have some doubts:
> 1. Do I really need a main page containing a button like "Click Here to Start
> Shopping"?
> I've hundreds of product's pages on my web site, and I like to be able to
> make my users start shopping from any page.
The only think you cxan do instead, is to make that form into a link.
I don'xt think you can avoid a entry form/page to the shop.
> 2. I didn't understand the "Navigation Tag" very well. Do I need to have a
> preview and a next page for each of my page, or it's only an option?
It's a option. If you maintain your own menu-system within the site,
you can skip the navigation tags.
--
Venlig hilsen / Best regards
Henning
_H_P_C_o_n_s_u_l_t_ E-mail: mailto:henning.petersen@hpc.dk
Skoletoften 9, Blans Work: http://www.hpc.dk
DK - 6400 Soenderborg Private: http://home1.inet.tele.dk/oz1lln
------------------------------
Date: 26 Apr 1998 01:06:57 -0400
From: Uri Guttman <uri@sysarch.com>
To: smoothie@spiritone.com
Subject: Re: Why doesn't this work?
Message-Id: <x7son1cgsu.fsf@sysarch.com>
>>>>> "DN" == Dave Neuer <smoothie@spiritone.com> writes:
DN> $dir = shift;
DN> opendir (D, $dir) or die "Can't open directory: $!\n";
DN> @files = readdir D;
DN> closedir D;
DN> foreach (@files){
DN> open (F, "<$dir/$_") or die "Can't open $_: $!\n";
DN> local $/ = undef;
DN> my $lines = <F>;
DN> $lines =~ s/.*(<meta\s[^>]*>).*/$1/mg;
DN> $file .= "$lines\n";
DN> close F;
DN> }
DN> open(F, ">metalist") or die "Can't open metalist: $!\n";
DN> print F $file;
DN> close F;
how about this one liner:
#!/usr/local/bin/perl -n0
# run this with the file you want to extract meta as the arglist.
# redirect output to your favorite file
while ( m/(<meta\s+[^>]+>)/ig ) { print "$1\n" ; }
hth,
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---- 8 Years of Perl Experience, Available Immediately
uri@sysarch.com --------- Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net -------- http://www.northernlight.com
------------------------------
Date: 26 Apr 1998 13:19:34 GMT
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: writing to file on site
Message-Id: <01bd7116$1dfa3d00$0f02000a@castle.sonnet.ru>
Hello
Can anybody explain me with an example, how to read data from cgi-form and
to write them into disk file, using Perl under Unix system?
Thanks forward.
--
Best wishes,
Michael Yevdokimov,
International Coordinator
of The Basic Network
--------------------------------------------
http://www.basicnet.sonnet.ru
http://basicnet.home.ml.org
Email: flanker@sonnet.ru
------------------------------
Date: 26 Apr 1998 13:35:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: writing to file on site
Message-Id: <6hvd73$9jp$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Michael Yevdokimov" <flanker@sonnet.ru> writes:
:Can anybody explain me with an example, how to read data from cgi-form and
:to write them into disk file, using Perl under Unix system?
use CGI;
use CGI::Carp qw(FatalstoBrowser);
my $path = "/file/with/world/write/perms";
open(FH, ">> $path")) || die "can't append to $path: $!";
my $form = CGI->new();
$form->save(*FH);
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Down that path lies madness. On the other hand, the road to hell is
paved with melting snowballs. --Larry Wall in <1992Jul2.222039.26476@netlabs.com>
------------------------------
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 2420
**************************************