[15479] in Perl-Users-Digest
Perl-Users Digest, Issue: 2889 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 28 09:05:25 2000
Date: Fri, 28 Apr 2000 06:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <956927115-v9-i2889@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 28 Apr 2000 Volume: 9 Number: 2889
Today's topics:
AXDTK - Apache XML Delivery Toolkit <matt@sergeant.org>
CGI Programmer Needed dereksas@yahoo.com
Re: File Parsing <morbus@disobey.com>
Re: Finding text in a file and renaming that file <morbus@disobey.com>
HELP! text file problem! <markchu@hotmail.com>
Re: HELP! text file problem! <blah@nospam.com>
Re: i think i may not know perl any more <gellyfish@gellyfish.com>
Info about Backtracking in Regex <fjherna@europa3.com>
Re: initialize hash to empty? <gellyfish@gellyfish.com>
Re: inserting $line into the middle of a list... <kmojar@bmjgroup.com>
Re: Is there a way to create a Perl executable. <peter_gonnissenNOpeSPAM@euroseek.com.invalid>
Re: JARQ (Just Another Regex Question) <Tbone@pimpdaddy.com>
Re: Need regexp guru help <hermann_fass@hotmail.com>
Re: need resource for porting from nt to unix <hermann_fass@hotmail.com>
newbie needs help with cgi-input... <jetlund@tele.ntnu.no>
Re: perl and CGI on Win32 <johan.stjernbecker@mbox330.swipnet.se>
Re: perl in NT .BAT files Question <sturdevr@yahoo.com>
Random number <stephane@siw.ch>
Re: Random number <blah@nospam.com>
Re: Regular Expression Newbie <morbus@disobey.com>
running Windows program from perl script colardelle@my-deja.com
Re: running Windows program from perl script <blah@nospam.com>
Re: script help! (Someone Special)
Re: sigrand.pl generated sig file not used by pine... <jan.grant@bristol.ac.uk>
Re: SQL & win32::ODBC <Iancu@aol.com>
what does this do? <R.C.Home@ncl.ac.uk>
Re: what does this do? <i.m.t.swartjes@wmw.utwente.nl>
Re: Windows Script Component using PerlScript <steve_woolet@us.ibm.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 28 Apr 2000 11:17:03 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: AXDTK - Apache XML Delivery Toolkit
Message-Id: <3909651F.6DFE607E@sergeant.org>
This is a heads-up for anyone interested in delivering XML converted to
HTML, WML or any other format using a stylesheet. The Apache XML Delivery
Toolkit is a suite of modules built on top of mod_perl to do just that.
This should be of interest to anyone who:
would like to deliver one document in more than one format.
would like to use XML to do that.
wants to deliver it fast.
wants standards based templating.
http://xml.sergeant.org/axdtk/
--
<Matt/>
Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org
------------------------------
Date: Fri, 28 Apr 2000 12:52:51 GMT
From: dereksas@yahoo.com
Subject: CGI Programmer Needed
Message-Id: <390988a1.54255121@news.rivernet.net>
I'm looking for a cgi coder to create a custom cgi script for use on a
website I'm working on. Of course, this would be a paying job.
Basically, it would be a customized version of a redirection script.
If you're interested let me know and I'll give you the details then
you can give me a cost to do it. Thanks.
Derek
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
------------------------------
Date: Fri, 28 Apr 2000 08:07:02 -0400
From: Morbus Iff <morbus@disobey.com>
Subject: Re: File Parsing
Message-Id: <morbus-25D143.08070228042000@news.totalnetnh.net>
In article <8e93tp$fob$1@nnrp1.deja.com>, scarey_man@my-deja.com wrote:
> If I have a file with the following line:
> aaaa bbbb cccc dddd
> how can I read the line into an array using split, even though the
> field separators are different lengths each time e.g. 4 spaces, and
> then 2 spaces?
Don't worry about counting the spaces. Use:
@blah = split (/\s+/, $line);
Which says "one of more" (+) "white space characters" (\s). Whitespace
is definied as " \t\n\r\f". If you're looking only for spaces, you could
do:
@blah2 = split (/ +/, $line);
HTH...
Morbus Iff
http://www.disobey.com/
------------------------------
Date: Fri, 28 Apr 2000 08:24:47 -0400
From: Morbus Iff <morbus@disobey.com>
Subject: Re: Finding text in a file and renaming that file
Message-Id: <morbus-A0ADDD.08244728042000@news.totalnetnh.net>
In article <0bf0fd7e.04c584a0@usw-ex0104-028.remarq.com>, fortbruce
<bruceNObrSPAM@mccausland.com.invalid> wrote:
> I'm pretty new to Perl and require some assistance with a Perl
> script. I have some dynamic text files which I need to be able
> to first: find the first occurance of text which begins with a
> tilda character and ends with a comma, I then need to change the
> name of that file to match the characters between that string
> and move that file to a different directory. This script will be
> run on an NT machine and the input files are FTP'd to a
> directory on that machine.
Welp, I'm not sure how'd you'd change the name of a file within Perl
(anyone know?), but if you can piece together my thoughts, you can (has
not been tested or syntax checked). Paricularly, I think the regexp will
cause a problem, but you get the idea at least...
# read in directory
opendir (DIR, "$dir");
my @files = readdir (DIR);
closedir (DIR);
# read in each file, and look for your line
foreach my $file (@files) {
open (FILE, $file);
@lines = <FILE>;
foreach $line (@lines) {
if ($line =~ /^~(.*),$/) {
open (NEWFILE, ">$1");
print NEWFILE @lines;
close(NEWFILE);
# delete the old file
unlink ($file);
last;
}
}
}
As mentioned, this is rough, has no error checking, hasn't been syntax
checked or tested. User beware ;)
Morbus Iff
http://www.disobey.com/
------------------------------
Date: Fri, 28 Apr 2000 19:59:29 +0800
From: Mark <markchu@hotmail.com>
Subject: HELP! text file problem!
Message-Id: <39097D21.3839535C@hotmail.com>
hi all,
Does anyone know how to get the total rows in a text file when using
perl?
Thanks for any helps!
Mark.
------------------------------
Date: Fri, 28 Apr 2000 14:02:37 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: HELP! text file problem!
Message-Id: <39097DDD.A952DF4B@nospam.com>
Hi Mark,
Mark wrote:
> Does anyone know how to get the total rows in a text file when
> using perl?
The special variable $. does that for you. ;)
<code>
while (<INFILE>) {}
print "$.\n";
</code>
Best regards,
Marco
------------------------------
Date: Fri, 28 Apr 2000 10:48:16 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: i think i may not know perl any more
Message-Id: <Q%dO4.1469$fT4.149933@news.dircon.co.uk>
Uri Guttman <uri@sysarch.com> wrote:
> i just got that in the mail. i am so worried about having to take this
> test again. i may fail. i may be proven as dumb as shit (or worse! -
> pg).
I got this too. BUt I forgot my password so I couldnt take the test again.
The boss made me write VB programs as a penance ... (actually that last
bit is a lie :).
/J\
------------------------------
Date: Fri, 28 Apr 2000 16:40:11 +0200
From: Javier Hernandez <fjherna@europa3.com>
Subject: Info about Backtracking in Regex
Message-Id: <Pine.LNX.4.21.0004281631440.1613-100000@david.lcv.es>
Hi All,
I am interesting in understanding the backtracking process
in Regex.
I am actually reading "Mastering Regular Expressions" but
I will need more specific information about Backtracking.
Best regards,
Javi, _____ fjherna@europa3.com
| http://www.europa3.com/users/fjherna
\_________(_)_________/ http://www.valux.org/
____________!___!___!___________ Valencia
--------------------------------------------------------------------
The amount of time between slipping on the peel and landing on the
pavement is precisely 1 bananosecond.
------------------------------
Date: Fri, 28 Apr 2000 11:52:55 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: initialize hash to empty?
Message-Id: <rYeO4.1480$fT4.149931@news.dircon.co.uk>
steve <schan_ca@geocities.com> wrote:
> Hello:
> How do I initialize a hash to empty?
> For an array, I do:
> @array = ();
> but how for a hash
> %hash = ();
Yes that's right.
Although of course a newly introduced variable *is* empty.
/J\
------------------------------
Date: Fri, 28 Apr 2000 13:02:05 +0100
From: Kourosh A Mojar <kmojar@bmjgroup.com>
Subject: Re: inserting $line into the middle of a list...
Message-Id: <39097DBD.EB936B1D@bmjgroup.com>
Larry,
Thank you for your kind reply. The one line of code you offered seems
like a good logical alternative to my attempts. A few notes for which
you may be able to help me further with. The original file may need more
than one table (second file) to be inserted, thus </TABLEDATA> (ive
decided to use </TABLECAPTION> now) could appear more than once and
needs individual attention (im using a counter to determine the next
table position).
The script with your addition now loops continuously inserting the same
table over and over again followed by </TABLEDATA>. It also seems to be
missing the first line of the table file?
My script (snip) looks something like the following:
if ($DoMerge =~ "on"){
$Table_Count = 1;
if ($line =~ "</TABLECAPTION>") {
# define and open table file for input
$TABLEFILE = "$TABLEPATH$Topic_ID\.t$TABLEREF[$Table_Count-1]";
open (TABLE_IN, $TABLEFILE) || die "Can't open $TABLEFILE.";
@table_lines = <TABLE_IN>; # slurp file into array
close (TABLE_IN); # close file now all lines in list
chomp @table_lines; # Remove new lines
@lines = map { m!</TABLECAPTION>! ? @table_lines : (), $_ } @lines;
print "\nMerged $TABLEFILE\n";
$Table_Count++;
}
}
Any more help appreciated. Kind regards,
Kourosh A Mojar
kmojar@bmjgroup.com
Larry Rosler wrote:
>
> In article <390721D6.56668298@bmjgroup.com> on Wed, 26 Apr 2000 18:05:26
> +0100, Kourosh A Mojar <kmojar@bmjgroup.com> says...
>
> ...
>
> > ... In this particular script I want to insert all
> > lines from a second file into the middle of the original file. My script
> > works by reading in each line from original file into a list (@lines).
> >
> > foreach $line (@lines) {
> > foreach ($line =~ "</TABLEDATA>") {
>
> I guess that 'foreach' is supposed to be 'if'. How odd!
>
> > open (TABLE_IN, $TABLEFILE) || die "Can't open $TABLEFILE.";
> > @table_lines = <TABLE_IN>; # slurp file into array
> > close (TABLE_IN); # close file now all lines in list
>
> You are reading the same file into the array @table_lines on every pass
> through a loop. Why not read it once, ahead of the loop, and conserve
> the universe's limited supply of resources?
>
> > foreach $table_line (@table_lines) {
> > #?! insert $table_line into @lines list #?!
> > }
> >
> > I know that "push (@lines, $table_line);" adds the $table_line's at the
> > end of the array but don't know how to insert in the middle while the
> > loop is looking at the "$line =~ "</TABLEDATA>"".
>
> Lauren Smith suggested splice(), but that requires knowledge of the
> index at which to splice, which your program doesn't keep track of.
>
> Also, I don't like modifying an array that is being looped over, even
> though it may work.
>
> > If anyone can understand my problem and might be able to help me I would
> > appreciate it ever so much. Thanking you in advance and for your kind
> > attention.
>
> Who could resist such a pleasant request?
>
> I would take a different approach. The function map() takes as input
> one list and produces as output a second list, based on code that is
> executed element-by-element on the input list. This seems like the
> perfect approach to your problem. Here's a try (assuming you want to
> insert ahead of each of the matched lines):
>
> @lines = map { m!</TABLEDATA>! ? @table_lines : (), $_ } @lines;
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Fri, 28 Apr 2000 03:55:18 -0700
From: Peter <peter_gonnissenNOpeSPAM@euroseek.com.invalid>
Subject: Re: Is there a way to create a Perl executable.
Message-Id: <0b2afd22.9111452a@usw-ex0102-084.remarq.com>
In article
<Pine.GSO.4.10.10004251754500.22115-100000@logan.ucdavis.edu>,
Alan Hopper <aahopper@mailbox.ucdavis.edu> wrote:
>
>As I understand it Perl gets compiled just before each
execution. Is there
>a way to create Perl object code (i.e. an .exe ) program that
does not
>need to be compiled every time it is run?
>
>
>
>
>
Hello Alan,
Perl is an interpreter, that means that each command is
translate to machinecode by the interpreter (perl.exe) when a
line from the script is read. Compiled progr
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 28 Apr 2000 10:53:38 GMT
From: Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
Subject: Re: JARQ (Just Another Regex Question)
Message-Id: <8ebqji$2o82$1@news.enteract.com>
jlamport@calarts.edu writes:
> Uri Guttman <uri@sysarch.com> wrote:
>
>> or a single line with until:
>>
>> $line = <DATA> until $line =~ /^[^!]*(?=NUMBER OF COWS)/ ;
>
>What's the purpose of the lookahead? It seems to me that
>
>$line=<FILEHANDLE> until ($line =~ /^[^!]*NUMBER OF COWS/);
>
>will do exactly what the OP wanted, without the extra clutter. Or am I
>missing something?
No, you are correct. And it's not clear that a (?=) at the very end
of a pattern achieves anything meaningful.
------------------------------
Date: Fri, 28 Apr 2000 12:27:21 +0200
From: Hermann Fass <hermann_fass@hotmail.com>
Subject: Re: Need regexp guru help
Message-Id: <39096789.DE03A75D@hotmail.com>
Why don't you just do s.th. like this:
# Start of code
open (DATA ,"<myNotesExportFile.txt");
while (<DATA>) {
# Line to be completed for all fields
($from,$mid,$date,$subj,$to,$mime,$type,$t,$x) =
/.*Received: from (\w+).*?Message-ID: (\w+)/;
print "From: $from\nMessage-ID: $mid\n ..."
}
But maybe I misunderstood something and there is
a more interesting question hidden behind your problem.
This thing looks easy to me and doesn't require a guru.
Hermann
Thierry Frey wrote:
>
> Hi,
>
> I'm trying to translate some mail folders from Notes to Netscape. I want
> to write a regexp to convert all the headers.
>
> In every header, Notes exports the following line that starts with
> $AdditionalHeaders :
> $AdditionalHeaders: Received: from fw-primary ([192.168.175.1]) by
> mailserv.dassault-systemes.fr (Lotus SMTP MTA Internal build v4.6.2
> (666.1 7-2-1998)) with SMTP id C125688D.0026FD09; Tue, 22 Feb 2000
> 08:05:51 +0100 Received: from host01-SIG.den.qwest.net
> ([205.168.252.194]) by fw-primary.dassault-systemes.fr; Tue, 22 Feb 2000
> 07:56:48 +0000 (MET) Received: from imo21.mx.aol.com (imo21.mx.aol.com
> [152.163.225.65]) by siggraph.org (8.9.1/8.9.1) with ESMTP id
> AAA20506; Tue, 22 Feb 2000 00:07:06 -0700 (MST) From:
> SLangUNIS@aol.com Received: from SLangUNIS@aol.com by imo21.mx.aol.com
> (mail_out_v25.3.) id m.19.155488f (9761); Tue, 22 Feb 2000 01:59:28
> -0500 (EST) Message-ID: <19.155488f.25e38dcf@aol.com> Date: Tue, 22 Feb
> 2000 01:59:27 EST Subject: Milan Bylaws To: frey@siggraph.org,
> thierry_frey@siggraph.org MIME-Version: 1.0 Content-Type: text/plain;
> charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: AOL for
> Macintosh sub 147
>
> I would like a regexp filter to output the following :
> From: SLangUNIS@aol.com
> Message-ID: <19.155488f.25e38dcf@aol.com>
> Date: Tue, 22 Feb 2000 01:59:27 EST
> Subject: Milan Bylaws
> To: frey@siggraph.org, thierry_frey@siggraph.org
> MIME-Version: 1.0
> Content-Type: text/plain; charset="US-ASCII"
> Content-Transfer-Encoding: 7bit
> X-Mailer: AOL for Macintosh sub 147
>
> I've tried to consider the line as a succession of fields, all starting
> with a key (ex MIME-Version) followed by a colon (:). I would like to
> separate each field by a '\n', and discard all fields beginning by
> "Received:"
>
> I've tried several approaches, without success. Can anyone help me out ?
>
> Thanks in advance,
> Thierry
------------------------------
Date: Fri, 28 Apr 2000 12:34:33 +0200
From: Hermann Fass <hermann_fass@hotmail.com>
Subject: Re: need resource for porting from nt to unix
Message-Id: <39096939.14477EC9@hotmail.com>
JR wrote:
>
> I need help finding an online tutorial/hint guide for porting perl from NT
> to unix
>
> thanks!
Congragultion, you are porting into the right direction.
I think you don't need a lot as long as all the libs are
installed.
Adding the path to your perl interpreter correctly,
i.e. add the following line as the 1st one in each script:
#!/usr/local/bin/perl
For normal applications this should do the trick.
Hermann
------------------------------
Date: Fri, 28 Apr 2000 14:50:17 +0200
From: Ola Jetlund <jetlund@tele.ntnu.no>
Subject: newbie needs help with cgi-input...
Message-Id: <39098908.27FEA1C9@tele.ntnu.no>
After trying for some time I know have a perl script that displays all images in a directory.
Now I need to be able to specyfi which directry throug a input in netscape:
/cgi-bin/dispim.pl?gallery
or something. How do I read this text into the script and use it?
--
------------------------------------------------------
Email: jetlund@tele.ntnu.no
Mail: Harald Bothnersvei 8, 7051 Trondheim, Norway
Telephone - work: +47 73 59 27 47
- home: +47 73 82 19 25
- mob.: +47 91 54 45 79
------------------------------
Date: Fri, 28 Apr 2000 12:12:31 +0200
From: Johan Stjernbecker <johan.stjernbecker@mbox330.swipnet.se>
Subject: Re: perl and CGI on Win32
Message-Id: <3909640E.FB2FEF1B@mbox330.swipnet.se>
Om win32 the first line of code DOESN´T need to be #!c:\etc\etc\
(only if you run apache web server and run is as a CGI-script.)
Otherwise you have to tell win that files ending with .pl (or.cgi) will be
executed by using the program C:\perl\bin\perl.exe (associate the file, that is)
yours, Johan
Peter wrote:
> In article <8ebft2$15q$1@charm.magnus.acs.ohio-state.edu>,
> "Youngsoo Kim" <sunvale@hotmail.com> wrote:
> >Hey...
> >
> >I just start to write perl script. I got a problem to execute
> >scripts on my machine.
> >
> >I have windows 98, and apache server installed.
> >Perl is installed on directory "c:\perl\bin\"
> >When I try to run perl script, I figure out I don't know how to
> start.
> >I don't know what I should write at the first line. I know in
> UNIX
> >perl script might start with #!/usr/bin/perl <- where perl is
> installed.
> >
> >But I don't know how to start on windows machine.
> >Please let me know.
> >
> >Thanks.
> >
> >
> >
> >
>
> Hi Youngsoo,
>
> if your perl is located in c:\perl\bin\, the first line of the
> cgi should be :
>
> #!C:\perl\bin\perl
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Fri, 28 Apr 2000 07:49:56 -0400
From: "BobS" <sturdevr@yahoo.com>
Subject: Re: perl in NT .BAT files Question
Message-Id: <8ebttc$8co$1@bob.news.rcn.net>
Hi,
Pardon me for butting in here. You guys seem to be doing what I want to do
and I could use some general help. TIA...
I have a large DOS-based app running under NT. Comm is currently scripted
via modem using BLAST. I want to integrate an FTP capability using the
existing executables and my thought is to substitute perl script and
functions for those now performed by BLAST scripts.
Unfortunately, I'm new to perl and there is an abundance of info available
that is not easy to digest. Please point me toward some docs, etc. that
explain perl in a DOS/NTVDM environment. Any help is definitely appreciated.
Bob
"Steve Kemp" <skx@tardis.ed.ac.uk> wrote in message
news:Pine.GSO.4.10.10004281041470.13822-100000@tardis.tardis.ed.ac.uk...
>
> On Fri, 28 Apr 2000, David Ness wrote:
>
>
> > I believe the code relies on a pun which lets the first line of the file
> > mean different things to the windows .BAT processor and to perl. Windows
> > can execute the beginning of the file and then skip the perl content
while
> > the perl processor skips the .BAT (Windows) part and sees only the perl
content.
> > Thus I guess it allows a sort of logical equivalent of Unix's `#!', in
that
> > it makes an `executable' which can conveniently mix Windows work with
> > perl.
>
> That is actually one of the funkiest pieces of code that I've seen
> for a long time.
>
> > The fragment looks like this:
> > @REM='<$MyName Demonstration File - Ver DN-1A(2) - [BKX-LUSZ]$>
> > @Echo Off
> > perl %PerlFlag% %BIN%\MyName.BAT %*
>
> I'd change that line, so that you don't have to specify the name
> of the batch file each time:
> perl %PerlFlag% %0 %*
>
>
> > GoTo EndPerl
> > @REM=';
> > ...
> > #Body of perl program appears here
> > ...
>
> To get rid of the warning just put something here:
>
> @REM='';
>
> > __END__
> > :EndPerl
> >
>
>
> > This has worked fine for a long time, but now that I am processing my
> > files with a `-w' I get a `used only once' on `@REM'. I can't use the
> > my() structure to avoid this because, while it works well other places,
> > here the `@REM' has to be the first thing encountered. I find I can
> > avoid the diagnostic by including a `@REM=@REM;' as the first line
> > of executable perl code, but I don't know if that is good practice or if
> > there is some better way.
>
> Ahh, thats what I said really, I cannot think of another way to do
> this, except to assign a dummy value to the @REM in your perl.
>
> > Alternatively, is there some better way to handle this whole problem in
> > Windows/perl?
>
> The way that I normally do things is to have two files:
>
> a.pl
> a.bat
>
> With a.bat containing :
>
> @echo off
> perl %~d0%~p0a.pl %0
>
> Your solution is neater as it only has one file, but mine's probably
> simpler to understand.
>
>
> Steve
> ---
> http://GNUSoftware.com/ -- GNU Software for Windows Users
> http://steve.org.uk/ -- All about Steve
>
------------------------------
Date: Fri, 28 Apr 2000 12:17:31 GMT
From: "Chello" <stephane@siw.ch>
Subject: Random number
Message-Id: <vjfO4.55446$6X3.1334894@news.chello.at>
Hi all,
I have a little problem I have to generate a random number with two limits
(upper limit and down limit) for example 1 and 4. When I call the script
this script would have to display "1" or "2" or "3" or "4". Does somebody
knows how to do it? Do you have an example?
Thanks a lot
Stéphane
------------------------------
Date: Fri, 28 Apr 2000 14:34:14 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Random number
Message-Id: <39098546.716B9CE5@nospam.com>
Hi Chello,
Chello wrote:
> I have a little problem I have to generate a random number with
> two limits (upper limit and down limit) for example 1 and 4. When
> I call the script this script would have to display "1" or "2" or
> "3" or "4". Does somebody knows how to do it? Do you have an
> example?
Try with '$my_random=(int rand 4)+1'. Hope it helps you.
Best regards,
Marco
------------------------------
Date: Fri, 28 Apr 2000 08:13:40 -0400
From: Morbus Iff <morbus@disobey.com>
Subject: Re: Regular Expression Newbie
Message-Id: <morbus-E3A7D2.08134028042000@news.totalnetnh.net>
In article <0cc72f2a.121ad2c8@usw-ex0105-034.remarq.com>, Groman
<gromanNOgrSPAM@thehelm.com.invalid> wrote:
> Is there a tutorial on the net that will help me, understand
> regular expressions at least partially(to do some basic pattern
> matching).
Take a look at the "Perl You Need to Know" at wdvl.com - one of the
articles had a good one page Regular Expression tutorial. Teaches what
you need to know without getting overly complicated...
> Number:Name:Text
> ..
> Number:Name:Text
>
> I want to isolate all entries from the file with Number
> bigger than $maxnum
> Later, I want to neutralize all the \n /n \t /t and HTML tags in
> them.
> and print them to STDOUT.
You could do this:
# remove tabs and newlines
$line =~ /(\t|\n)//;
# remove HTML tags:
$line =~ /<([^>]+)>/;
# split the line by colons:
my ($number, $name, $text) = split(/:/, $line);
# compare $number and assign to "keep me" variables
if ($number > $maxnum) {
$KMnumber = $number;
$KMname = $name;
$KMtext = $text;
}
And then just print everything from here. HTH.
Morbus Iff
http://www.disobey.com/
------------------------------
Date: Fri, 28 Apr 2000 12:24:42 GMT
From: colardelle@my-deja.com
Subject: running Windows program from perl script
Message-Id: <8ebvtt$l6a$1@nnrp1.deja.com>
Hello,
I am quite new with perl, so it may be a very simple question. I am
writing perl scripts on a W95 PC and I would like to run Windows
programs (ie NOTEPAD) from a Perl script.
Thanks in advance.
Daniel
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 28 Apr 2000 14:40:18 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: running Windows program from perl script
Message-Id: <390986B2.C77CEE5D@nospam.com>
Hi Daniel,
colardelle@my-deja.com wrote:
> I am quite new with perl, so it may be a very simple question. I
> am writing perl scripts on a W95 PC and I would like to run
> Windows programs (ie NOTEPAD) from a Perl script.
Try with
system 'NOTEPAD TEST.TXT';
Hope it helps you. ;)
Best regards,
Marco
PS Amaze yourself: on an NT-Box you can perform simply
system 'TEST.TXT';
without the name of the application... :)))
------------------------------
Date: Fri, 28 Apr 2000 13:02:02 GMT
From: info@nowhere.com (Someone Special)
Subject: Re: script help!
Message-Id: <39098944.579575866@news.fast.net>
On Thu, 27 Apr 2000 16:21:07 -0400, tadmc@metronet.com (Tad McClellan)
wrote:
>On Wed, 26 Apr 2000 12:41:35 GMT, Someone Special <info@nowhere.com> wrote:
>>On Tue, 25 Apr 2000 14:52:04 -0700, Tom Phoenix <rootbeer@redcat.com>
>>wrote:
>>
>>>On Tue, 25 Apr 2000 dreiger@rnci.com wrote:
>>>
>>>> Subject: script help!
>>>
>>>> I am NOT any kind of programmer
>>>
>>>So, do you want to become a programmer, or to hire one? If you're looking
>>>to become one, perhaps you should search for an introductory course on
>>>programming. If you'd like to hire one, there are many newsgroups with
>>>'jobs' in their names, or you could just visit your local Perl Mongers.
>>>
>>I think you missed the point -
>
>
>No, *you* have missed the point!
>
>If we do your work for you, then you should send us your paycheck.
>
Please don't take this as a personal attack, or flame, but...
Rant mode on:
Ok, fine. Show me the exact line that askes the group to
rewrite this script. It's comments, and the lack of help like this
that turns potential programmers (I'm not saying I'm one of them) off.
I'm more than willing to help someone out with their network problems,
and now and then I have removed a complete config and rebuilt it
because of how bad the design was. I've held more than one hand with
OS & network problems, sometimes to very late in the night. Maybe I
should have charged them, but do you know there's more important
things in the world than money?
From what I've seen of this group, it's been pointless to post
anything here. So far, all I've seen is a bunch of RTFM's, followed
by a bunch of bitching and crying. There has been one person that
jumped right in and helped. I'll keep his username out of this since
this will probably generate a few flames. If this is want it takes to
be a perl guru, no thanks.
Rant mode off.
>I missed where you agreed to do that.
>
>
>>I don't plan to ever be a programmer,
>>and have had this project dumped on me, with no options but to write
>>this, or job hunt.
>
>
>Something has to give.
>
>You cannot be "not a programmer" and modify programs.
>
>If you modify programs, you _are_ a programmer, whether you
>want to be one or not.
>
>
>
>So your options reduce to:
>
> 1) become enough of a programmer to get through the assigned job
>
>or
>
> 2) start mailing resumes
>
>
>Good luck.
>
>
>--
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Fri, 28 Apr 2000 10:07:14 GMT
From: jan grant <jan.grant@bristol.ac.uk>
Subject: Re: sigrand.pl generated sig file not used by pine...
Message-Id: <390962D1.81B3922@bristol.ac.uk>
PSG wrote:
>
> hello,
>
> Well, I have started the sigrand.pl prog which runs as daemon and provides
> random sigs for tin posted mails, or normal mails etc. It works fine when
> I mail from tin, as you can see for this mail :) But pine doesn't somehow
> read the .signature file. I checked the script, it creates the .signature
> as 'named pipe' file, which when cat'ed gives every time gives a diff sig.
> But the file size is 0 as a special file (well sort of), maybe this causes
> a problem for pine.
>
> Another strage thing is that, when I go to sig file modfn feature of pine,
> It does show the random sig file, and if saved replaces the pipe file with
> a normal file. However if not saved, 'compose' doesn't bring up the editor
> with .sig file included.
>
> Any way to solve this?
use pine's ability to run a sig-generating program directly - ie, set
your sig file to
"program-to-produce-a-single-sig-on-stdout.pl|"
--
perl -e 's?ck?t??print:perl==pants if $_="Just Another Perl Hacker\n"'
------------------------------
Date: Fri, 28 Apr 2000 21:20:42 +0930
From: "I.Caragea" <Iancu@aol.com>
Subject: Re: SQL & win32::ODBC
Message-Id: <3909806f_2@news.chariot.net.au>
use Win32::ODBC;
my ($db, $stmt, $TableName, $Field1, $Field2);
......
# set $TableName, and $Field1, $Field2 with the values you want to add
......
$db = new Win32::ODBC("DSN=YourDNS;UID=UserName;PWD=Password;");
$stmt = "INSERT INTO [$TableName] (FieldName1, FieldName2) VALUES
('$Field1', '$Field2');";
$db->Sql($stmt);
$db->Close();
Hope this helps :)
Mircea.
------------------------------
Date: Fri, 28 Apr 2000 13:13:48 +0100
From: rich <R.C.Home@ncl.ac.uk>
Subject: what does this do?
Message-Id: <8ebv9t$fiq$1@ucsnew1.ncl.ac.uk>
Can anyone give me some info on this instuction..?
$value =~ s/%(..)/pack("C", hex($1))/eg;
thanks
Rich
------------------------------
Date: Fri, 28 Apr 2000 14:52:11 +0200
From: "Ivo Swartjes" <i.m.t.swartjes@wmw.utwente.nl>
Subject: Re: what does this do?
Message-Id: <8ec1hr$kf9$1@dinkel.civ.utwente.nl>
It substitutes the %12 and other %xx signs in submitted forms to the
character belonging to the value after the % (the xx)
Ivo Swartjes
rich <R.C.Home@ncl.ac.uk> schreef in berichtnieuws
8ebv9t$fiq$1@ucsnew1.ncl.ac.uk...
> Can anyone give me some info on this instuction..?
>
> $value =~ s/%(..)/pack("C", hex($1))/eg;
>
> thanks
>
> Rich
>
>
------------------------------
Date: Fri, 28 Apr 2000 06:47:19 -0400
From: "Steven P. Woolet" <steve_woolet@us.ibm.com>
Subject: Re: Windows Script Component using PerlScript
Message-Id: <39096C37.7249A755@us.ibm.com>
goodjob666@my-deja.com wrote:
>
> > I'm trying to implement a Windows Script component using PerlScript.
> > When I attempt to register the component, I get a runtime error from
> > regsvr32.exe of: abnormal program termination. This happens even
> > when I try the "SayHello" example in the ActiveState documentation.
> > If I remove the part having to do with PerlScript, it will register
> > successfully.
>
> Are you using build 613?
I have build 613 installed on Windows 2000 Advanced Server and I also
have build 522 installed on NT Workstation 4.0 with Service Pack 6.
>
> > Does anyone know if regsvr32 on Windows2000 can actually register a
> > PerlScript?
>
> It should work with 613. It does not work with 522. Try regsvr32 on
> PerlSE.dll in the Perl/bin/ directory first, then register the Windows
> Script Component. It is used like this in an XML page, right?
>
As it turns out...the component works on the 522 version on NT 4.0 (I
did download the patches for Windows Script Host), but the 613 version
on 2000 Advanced Server does not work.
The xml file that is installed with ActivePerl (file First.wsc in
Perl\eg\Windows Script Component) is:
<?xml version="1.0"?>
<component>
<registration
description="First"
progid="First.WSC"
version="1.00"
classid="{d0ccb637-bd0c-4c90-a4bd-7473f499d35a}"
>
<comment> This makes the messagebox pop up on registration and
unregistation </comment>
<script language="PerlScript">
<![CDATA[
sub register {
use Win32;
Win32::MsgBox('Windows Script Component says: First.WSC has been
registered!');
}
sub unregister {
use Win32;
Win32::MsgBox('Windows Script Component says: First.WSC has been
unregistered!');
}
]]>
</script>
</registration>
<comment> Themethods and properties to expose to the data consumer
</comment>
<public>
<property name="YourName">
<get internalName="hiddenGetProperty"/>
<put internalName="hiddenSetProperty"/>
</property>
<method name="SayHello">
</method>
</public>
<comment> The code that implements the functionality of the
component.</comment>
<script language="PerlScript">
<![CDATA[
use vars qw($YourName_Property);
sub hiddenGetProperty {
return $YourName_Property;
}
sub hiddenSetProperty {
my($param) = shift;
$YourName_Property = $param;
}
sub SayHello {
return "Hello $YourName_Property!";
}
]]>
</script>
</component>
> <%@Language=PerlScript%>
> <%
> $obj = $Server->CreateObject('Easy.WSC');
> $retval = $obj->SayHello("Hello World");
>
> $Response->Write($retval);
> %>
>
> If it fails to work, file a bug report with http://bugs.ActiveState.com.
>
> Jon
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 2889
**************************************