[10766] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4367 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 6 08:07:25 1998

Date: Sun, 6 Dec 98 05: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           Sun, 6 Dec 1998     Volume: 8 Number: 4367

Today's topics:
        "Double" variable interpolation? <luis-1@rocketmail.com>
    Re: "Double" variable interpolation? (Michael R Weholt)
    Re: "Double" variable interpolation? <gellyfish@btinternet.com>
    Re: CGI Redirection <cyberbob@infinet.com>
        database cgi script <jyin2@uic.edu>
        date file last modified check? (Loans2001)
    Re: date file last modified check? (Larry Rosler)
    Re: Fast way to produce block of random bytes? (Bart Lateur)
    Re: Fast way to produce block of random bytes? <gellyfish@btinternet.com>
    Re: Fastest way to search through an array? <uri@sysarch.com>
    Re: Finite State Auto.. (Tad McClellan)
    Re: How can I make it impossible to use the browser's b <admin@linkworm.com>
    Re: How to disallow fields to input puncuations excepts ("> GiLLY  ">)
    Re: Is Tcl/Tk better than Perl ? <ebohlman@netcom.com>
        Looking for Perl Programmers hish@my-dejanews.com
        Perlshop Customization Questions lsmhqhc@hotmail.com
    Re: Perlshop Customization Questions <gellyfish@btinternet.com>
    Re: Petition: Contrast: South Australian gov't has 20 y (Fergus Henderson)
    Re: Problem with seek..... (Bart Lateur)
    Re: regex: anchor or comma <gellyfish@btinternet.com>
        Running .pl and .cgi files in dos. <bradnix@geocities.com>
    Re: Running .pl and .cgi files in dos. <gellyfish@btinternet.com>
        what sendmail under NT <nospamm@deleteme>
        Writing sound files with perl <danny@sg1501.chemie.uni-marburg.de>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 06 Dec 1998 00:00:56 -0600
From: "A.T." <luis-1@rocketmail.com>
Subject: "Double" variable interpolation?
Message-Id: <366A1D97.C9E4B5F5@rocketmail.com>

Hi there... i guess there must be a better way to do this but im really
stuck now.

I have this cgi that takes several arguments from a form... the data it
gets are questions and answers to build a web page of the following
form.

1. Question 1
- Choice 1
- Choice 2

2. Question 2
- Choice 1
- Choice 2

and so on... the problem is that i dont get all my variables to get
substituted on the web page. The parsed cgi data is the tipical
$in{'question1'} type of variable and using the following code chunk i
can get the variable names but not the values

---- chunk of code

for ($i=1; $i < $question_total; $i++) {
 $question = '$in{'."q$i}";   # this part works
 $result .= "<P><LI> $question<BR>\n"; # here the variable doesnt get
substituted
 for ($j=1; $j < $answers_per_question; $j++) {
  $name = 'a'.$j."q$i";
  $resp = "\$in{\'a".$j."q".$i."\'}";
  $result .= "<input type=radio name=$name> $resp<BR>\n";
  }
 }
------ end chunk of code

what i get from this (and from other code that seems to work fine) is a
web page that looks like this:

1. $in{q1}       <-- Instead of "Question 1" which is the value of that
variable
- $in{'a1q1'}    <-- Instead of "Choice 1" which is the value of that
variable
- $in{'a2q1'}

2.$in{q2}
- $in{'a1q2'}
- $in{'a2q2'}

and well thats the question, i've tried many things but the variables
just dont get substituted =(

Hope someone can help, thanks

 A.T.




------------------------------

Date: Sun, 06 Dec 1998 11:36:00 GMT
From: awnbreel@panix.com (Michael R Weholt)
Subject: Re: "Double" variable interpolation?
Message-Id: <74dq70$ts_004@mrw.panix.com>

In article <366A1D97.C9E4B5F5@rocketmail.com>, 
"A.T." <luis-1@rocketmail.com> wrote:

>and so on... the problem is that i dont get all my variables to get
>substituted on the web page. The parsed cgi data is the tipical
>$in{'question1'} type of variable and using the following code chunk i
>can get the variable names but not the values
>
>---- chunk of code
>
>for ($i=1; $i < $question_total; $i++) {
> $question = '$in{'."q$i}";   # this part works

Well, except I don't really think it does work. How could it? You've 
put the $in{ part inside single quotes which makes it a literal value 
and thus the whole construct $in{q1} couldn't possibly be seen by perl 
as a variable, and so it won't be interpolated. It looks to perl like 
something that costs in{q1} dollars, whatever that is. Try something 
like this:

for ($i=1; $i < $question_total; $i++) {
  $key = join '', 'q', $i;
  $question = $in{$key};
        ...
}

There are probably simpler ways, but at least the above makes it 
fairly clear what you are doing.


-- 
 mrw


------------------------------

Date: 6 Dec 1998 11:44:07 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: "Double" variable interpolation?
Message-Id: <74dqm7$bd$1@gellyfish.btinternet.com>

On Sun, 06 Dec 1998 00:00:56 -0600 A.T. <luis-1@rocketmail.com> wrote:
> Hi there... i guess there must be a better way to do this but im really
> stuck now.
> 
> I have this cgi that takes several arguments from a form... the data it
> gets are questions and answers to build a web page of the following
> form.
> 
> 1. Question 1
> - Choice 1
> - Choice 2
> 
> 2. Question 2
> - Choice 1
> - Choice 2
> 
> and so on... the problem is that i dont get all my variables to get
> substituted on the web page. The parsed cgi data is the tipical
> $in{'question1'} type of variable and using the following code chunk i
> can get the variable names but not the values
> 
> ---- chunk of code
> 
> for ($i=1; $i < $question_total; $i++) {
>  $question = '$in{'."q$i}";   # this part works
>  $result .= "<P><LI> $question<BR>\n"; # here the variable doesnt get
> substituted
>  for ($j=1; $j < $answers_per_question; $j++) {
>   $name = 'a'.$j."q$i";
>   $resp = "\$in{\'a".$j."q".$i."\'}";
>   $result .= "<input type=radio name=$name> $resp<BR>\n";
>   }
>  }
> ------ end chunk of code
> 
> what i get from this (and from other code that seems to work fine) is a
> web page that looks like this:
> 
> 1. $in{q1}       <-- Instead of "Question 1" which is the value of that
> variable
> - $in{'a1q1'}    <-- Instead of "Choice 1" which is the value of that
> variable
> - $in{'a2q1'}
> 
> 2.$in{q2}
> - $in{'a1q2'}
> - $in{'a2q2'}
> 
> and well thats the question, i've tried many things but the variables
> just dont get substituted =(
> 

No but there again Perl is doing exactly what you are asking it to do.

The line:

>   $resp = "\$in{\'a".$j."q".$i."\'}";

for instance is not going to interpolate %in at all because you have escaped
the $ - thus you get the literal '$in{ <etc>' with only $i & $j interpolated.
Get rid of the back slash and you might find that things change.

On the earlier line:

>  $question = '$in{'."q$i}";   # this part works

That aint working at all - here because you have used the single quotes around
the '$in{' part which again precludes interpolation - you would be better off
writing that as

$question = "$in{q$i}";

You dont need all of that extra quoting and string catenation - if it makes
you happier to have quotes around the key of the hash then you can use
generalized quoting thus:

$question = qq|$in{"q$i"}|;

I think the basic problem here is a misunderstanding of the way that
variable interpolation works - I would suggest going back and reading the
perlop manpage.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Sun, 06 Dec 1998 07:20:29 GMT
From: Brad Whitaker <cyberbob@infinet.com>
Subject: Re: CGI Redirection
Message-Id: <366A303C.E343CFF@infinet.com>

I just did a web site like that, http://reach.to for a guy.  What I did
was have 404s redirected to my 404.pl which then checks to see if the
the request URI is in the member database and if it is, then it extracts
the URL to redirect to from the database and just prints a dummy page
with 2 frames whose sizes = 100%, *. The large frame is the user's
normal site URL, and the small frame is just a dummy. This keeps the
requested URL in the location bar of the browser.  Or, if you didn't
care about what was in the location bar of the browser, you could just
print a Location: URL\n\n header.  I guess I can give you some source
code if you need it.

fairbairn_97@yahoo.com wrote:
> 
> Hi...
> 
> I was enquiring whether any body knows where I can get a CGI script that
> redirects URLs to another place automatically... I was planning on doing
> something like ML.ORG where they redirect TEST.HOME.ML.ORG to
> www.mydomain.com/test/test/test/go.html
> 
> Please help.... Email me on fairbairn_97@yahoo.com
> 
> He who gives me the correct answer will be placed on the front page of my web
> site....... THanx in advance
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

-- 
BRaD WHiTaKeR
(CyBeRBoB@iNFiNeT.CoM)
(CyBeRBoB@MiNDLeSS.CoM)
(BRaDWHiT@GeoCiTieS.CoM)
(BRaDWHiT@eaRTHLiNG.NeT)
(http://www.infinet.com/~cyberbob)


------------------------------

Date: Sun, 6 Dec 1998 00:51:30 -0600
From: "Jia Yin" <jyin2@uic.edu>
Subject: database cgi script
Message-Id: <74d9pd$5vp$1@tepe.tezcat.com>

hi
Im looking for a perl script that counts the #s of result for a search*
(like a search engine, sortof).

* I don't want like a perl script that can search the whole site but just
the given database... and gives the #s of the results.. that's all...
if anyone has something like this and would like to help me out... please
send your comments/script/whatever to

cgiscript@absolutecareer.com


THANK YOU!




------------------------------

Date: 6 Dec 1998 03:19:23 GMT
From: loans2001@aol.com (Loans2001)
Subject: date file last modified check?
Message-Id: <19981205221923.19320.00000655@ng04.aol.com>

Hello,

I wrote a program in perl to create a table of my loan pricing at various
interest rates .  I'd like my cgi program to simply read the date the file was
uploaded to the server and say, "this file was last modified on ______"

I tried using perl's -M function on the interest rates file, and I got the age
of the file, but I want perl to subtract the age of the interest rates file
from the current system date and print that date each day someone clicks on the
thing so I don't have to keep manually changing the program each time to read
the date I'm uploading the new rates file.

Any thoughts on this?

Thanks.

Scot King


------------------------------

Date: Sat, 5 Dec 1998 20:35:35 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: date file last modified check?
Message-Id: <MPG.10d3a971d72f2d20989942@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <19981205221923.19320.00000655@ng04.aol.com> on 6 Dec 1998 
03:19:23 GMT, Loans2001 <loans2001@aol.com> says...
 ...
>      I'd like my cgi program to simply read the date the file was
> uploaded to the server and say, "this file was last modified on ______"
> 
> I tried using perl's -M function on the interest rates file, and I got the age
> of the file, but I want perl to subtract the age of the interest rates file
> from the current system date and print that date each day someone clicks on the
> thing so I don't have to keep manually changing the program each time to read
> the date I'm uploading the new rates file.

Instead of using the -M function, use (stat ...)[9], which gives the 
modification time in seconds since the Unix Epoch (1970-01-01 00:00:00 
UTC).  See `perldoc -f stat` for details.

Then you can convert that to local time using the localtime function in 
scalar context to get a default-formatted string, or localtime in list 
context + [s]printf to format the output you want.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Sun, 06 Dec 1998 12:11:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Fast way to produce block of random bytes?
Message-Id: <36737448.7326335@news.skynet.be>

[comp.lang.perl.modules snipped, as I can't see the relevance]

Gerben_Wierda@RnA.nl wrote:

>Which means that my previous solution was about 3 times as fast as what was 
>suggested by Larry.

So here are my stabs.

	# in place replacement of each byte
	$result = ' ' x 1024;
	for($i = 0; $i<1024;$i++) {
		substr($result,$i,1) = chr(int rand 256);
	}
or
	# join 1024 random bytes
	$result = pack('C*', map { int rand 256 } 1 .. 1024);


I don't bother with benchmarking. Both are tested, though.

	Bart.


------------------------------

Date: 6 Dec 1998 12:27:10 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Fast way to produce block of random bytes?
Message-Id: <74dt6u$em$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was sent to 
> <Gerben_Wierda@RnA.nl>],
> who wrote in article <F3Eus4.8u5@RnA.nl>:
>> I would like to produce a block of 1024 random bytes. I cannot just use rand 
>> and() and add it to a string, because it will get added as a number, which 
> 
> You cannot use rand() because it is not random.  Until perl reads from
> /dev/random, the maximum you can expect is to get 2, maybe 4 random
> bytes from Perl.
> 

One can always use /dev/random or /dev/urandom if they exist (they have for a 
while on Linux):


#!/usr/bin/perl

open(RANDOM,"/dev/urandom") || die "No random device - $!\n";

read(RANDOM,$randstring,1024);

close(RANDOM);

print $randstring;

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 05 Dec 1998 23:14:13 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Fastest way to search through an array?
Message-Id: <x7u2z9x5yi.fsf@sysarch.com>

>>>>> "EB" == Eric Bohlman <ebohlman@netcom.com> writes:

  EB> Uri Guttman <uri@ibnets.com> wrote:

  EB> : this is just a grep so use it:

  EB> : 	push @master_list, grep( exists $temp{$_}, @pop_user ) ;

  EB> : you need the exists since we created the hash with values of undef

  EB> Actually, you need 'not exists' because the original code actually set 
  EB> @master_list to the union of its old value and @pop_user.

at this point in the thread i have totally lost the actual need of the
original poster (and i am not going back to look for it). it wasn't even
clear other than some array lookup that should be done with hashes. i
just wanted to bring good ol' hash slices into the picture.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


------------------------------

Date: Sun, 6 Dec 1998 01:49:37 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Finite State Auto..
Message-Id: <hucd47.ucd.ln@metronet.com>

Tech-No (zerocool@montana.campus.mci.net) wrote:
: I was wondering if anyone had a Perl script that would test a string to
: see if it was a FSA???  If so please email me the source.


   A _string_ can be a _machine_?

   Whatever are you speaking of?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 05 Dec 1998 23:37:39 -0800
From: TRG Software <admin@linkworm.com>
Subject: Re: How can I make it impossible to use the browser's back button in a script??
Message-Id: <366A3443.6078@linkworm.com>

Katia Hayati wrote:
> 
> Hi,
> 
> I'm no expert but I've given thought to this problem for another
> application. What I would do is have that menu in a window without the
> toolbar (you can do that with JavaScript), and then capture the Window
> events (also with some JavaScript code) to make it impossible for a user
> to right click on the window and go back.
> 
> Hope that helps (?)
> 
> K.H.
> 
> On Fri, 4 Dec 1998 Rafely@xxiname.com wrote:
> 
> > Hello,
> >
> > Sorry if the subject was not so clear, but here is what I want to do.
> > I have a database with members. When members log in, they will get a
> > menu. Using the menu they can edit their account or configure the
> > service they receive. Members can also delete their account. When
> > someone delete their account, they will get a confirmation screen. But
> > they can always use their back button to go back to the menu, and try
> > to configure stuff! This could harm the database!! What I want to do
> > is make it impossible to return to the menu when a member delete their
> > account. How can I do that? Please let me know.
> >
> > Many Thanks
> >
> > Rafely
> > Rafely@xxiname.com
> >
> >
 

That's insane... It's *not* possible. What do you plan to do about
people whom have their java disabled, or if they use Lynx, etc? Simply
put, something needs to be implemented in the script that keeps track of
the users session.. And of course, if they delete their account, no
active session for them.... Nothing compicated.. you need to approach
this situation differently... 
-- 
Regards,
Tim Greer - admin@linkworm.com
TRG Software and The Link Worm
TRG Software: http://www.linkworm.com/trg
The Link Worm: http://www.linkworm.com
Chat Sites: http://chat.redding.net
--------------------------------------------------------------------
* Creator of Paradise Chat, Chat Central, Galaxy Chat,
  Spiral Chat, Party Chat, and more. http://www.chatbase.com
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application

      Copyright ) 1998 TRG Software and The Link Worm.


------------------------------

Date: Sun, 06 Dec 1998 03:43:30 GMT
From: hklife@soback.kornet21.net ("> GiLLY  ">)
Subject: Re: How to disallow fields to input puncuations excepts
Message-Id: <366bfc87.1842937@usenet.kornet21.net>

print "error" unless $input =~ /^[a-z0-9-]+$/;

targetmailinfo@yahoo.com @[<:GQ1[:

">Dear perl and cgi experts,
">
">	If I want to disallow my visitors to input all puncuations and blank
">space  EXCEPT HYPHEN ( - ) and A to Z , 0 to 9   at my form's field "company"
">how can I do that??
">
">	The following will disallow all puncuations , blank spaces and hyphen as
">well (only allow a-z and 0-9).
">
">	How to enable the hypens , a-z , 0-9 but disable blank space and other
">puncuations at the company??
">
">if ($form{'company'} =~ /\W/)
">{
">print "Content-type: text/html\n\n";
">print <<__W1__;
"><h1>No puncuations please, only allow A-Z 0-9 and hyphens.</h1>
">__W1__
">exit;
">}
">
">Thank you Thank you Thank you
">
">LaHaHaHaHa
">
">-----------== Posted via Deja News, The Discussion Network ==----------
">http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


GiLLY @}`,------
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
!F 1W4k 3*?!0T4B >pA&3* GQ<[@L 2I@L?4@84O 0q8q1f 59>F3*?@4B  !F
">   594c ?6?!<- H/Hw 9L<RA~0m @V4B 5i2I GQ<[@L?M55 00>F    ">
!F    H%@Z@V>n >5>5GQ 3*@G 0!=??! Hq8A@; @|GXAV4x 9NA$|#     !F
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
ICQ: 15668514 (jE~lmhxlm 09:00~18:00 ?B6s@N)
PCS: 016-359-0733 (jE~wO 09:00~22:00, lm 14:00 ~ 22:00 J&Rv)
PCS SMS: 3590733@sms.pcs016.co.kr (max. 40 characters)


------------------------------

Date: Sun, 6 Dec 1998 06:15:43 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Is Tcl/Tk better than Perl ?
Message-Id: <ebohlmanF3J5E7.LI7@netcom.com>

Patrick Fichou <fichou@clubintnet.fr> wrote:
: I woul *really* know what you think of Tcl/Tk ! I mean, do I have to learn
: Perl instead of Tcl ? Is Perl somewhat out of date ?
: Is it a correct choice I do if I choose Tcl ? ...and so on !

Both Perl and Tcl have their uses; it's meaningless to talk about one of 
them being "better" than the other in general without specifying a 
particular usage.  In most real-world scenarios, the choice is best made 
by considering things like:

1) Which language do the people working on the project already have 
more experience with?

and

2) How much existing code which can be incorporated into your project 
exists in each language?

Note that both Tcl and Perl (as well as Python and possibly some other 
languages) support Tk, so its availability is not a deciding factor.

Perl is not in any way shape or form "out of date."  There's a very 
active development team working on the language itself, and even more 
people are writing modules for it every day.  The situation with Tcl is 
exactly the same, and I presume you could also say that about Python.  
Once again, level of development activity is not a deciding factor.

I think it's safe to say that far more people have experience with Perl 
than with Tcl, but this isn't as important as it might seem, as a lot of 
those people's experience may apply only to rather limited areas that 
have nothing to do with what you're trying to accomplish.



------------------------------

Date: Sun, 06 Dec 1998 10:40:33 GMT
From: hish@my-dejanews.com
Subject: Looking for Perl Programmers
Message-Id: <74dmv2$4hg$1@nnrp1.dejanews.com>

Hi all,


We are looking for Perl programmers, prefereably based in Singapore, Malaysia,
Indonesia or Thailand.

Please send resume by reply post if interested in contract work.

Many thanks and Merry Christmas
MHI

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Sun, 06 Dec 1998 06:57:44 GMT
From: lsmhqhc@hotmail.com
Subject: Perlshop Customization Questions
Message-Id: <74d9t8$pvp$1@nnrp1.dejanews.com>

Hi folks,

I would like to know if and how I can make the following changes to Perlshop
(shopping cart):

1. Flat shipping rate for orders under $200 and free shipping for orders over
$200.

2. Adding a "Back to Homepage" button to the order confirmation page. It's a
dead end, the user can't do anything from there.

Thanks in advance for your time and help.

Cheers,
LSM

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 6 Dec 1998 11:20:18 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perlshop Customization Questions
Message-Id: <74dp9i$98$1@gellyfish.btinternet.com>

On Sun, 06 Dec 1998 06:57:44 GMT lsmhqhc@hotmail.com wrote:
> Hi folks,
> 
> I would like to know if and how I can make the following changes to Perlshop
> (shopping cart):
> 
> 1. Flat shipping rate for orders under $200 and free shipping for orders over
> $200.
> 
> 2. Adding a "Back to Homepage" button to the order confirmation page. It's a
> dead end, the user can't do anything from there.
> 

I'm sure you can do both of these things - after all you do have the source
code of the application.  But beyond that theres not much more that can be
said.  People tend to take it as being rather poor taste being asked to
support somebody elses code that just happens to be written in Perl.

If the application is well enough documented then it should be clear as to
where you might make these changes - if it is not clear then perhaps your
first line of recourse should be the applications author and then if the
author is either unable or unwilling to offer support (I am assuming this is
free software here) then perhaps you should consider hiring a programmer to
do the job.

Alternatively, if you feel you know sufficient Perl yourself, you should
examine the source code of the application to discover how you might do
these changes yourself - to me it doesnt sound very difficult at all but
thats slightly hungover sunday morning hubris.  If you should decide to
do the changes yourself and find yourself with a problem and after having
thoroughly read the Perl documentation and the FAQs - then if you can isolate
the smallest possible part of code you might post to the appropriate
newsgroup - bearing in mind that the *appropriate newsgroup* might not be
this one if it is a problem with a CGI application.

Good luck

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 6 Dec 1998 07:30:43 GMT
From: fjh@cs.mu.oz.au (Fergus Henderson)
Subject: Re: Petition: Contrast: South Australian gov't has 20 yr Microsoft-Only Contract!
Message-Id: <74dbr3$gkn$1@mulga.cs.mu.OZ.AU>

"ARA" <ara@neWave.net.au> writes:

>[...] in South Australia, where (perhaps to get EDS to
>relocate to Adelaide) the State gov't has reportedly
>signed a contract which makes it ILLEGAL for them to
>use anything but Microsoft software products?

Could you please give more details and/or some
source that we can confirm this from?

>For details, find an archive of our local LUNIX SA
>mailing list (Nov/Dec 98) and read what "insiders"
>have had to say about the deal.

I didn't have any luck finding the appropriate articles
with a web search.  Could you give a URL?

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh@128.250.37.3        |     -- leaked Microsoft memo.


------------------------------

Date: Sun, 06 Dec 1998 12:17:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Problem with seek.....
Message-Id: <367474b0.7430089@news.skynet.be>

bravo wrote:

>> open(IN,'logfile');
>> @line = reverse <IN>;
>>
>> Bart.
>
>OK cool..... ill give that a go.

Be aware of the dangers. Experienced Perl programmers know them very
well, but newbies might forget about them.

[A], you're reading in a whole file, which means that you could have
memory/speed problems if the file gets big. And [B], test the file open,
and please lock the file; but the latter will only help if all programs
writing to this file do the same (on Unix like OS'es).

	Bart.


------------------------------

Date: 6 Dec 1998 12:02:55 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: regex: anchor or comma
Message-Id: <74drpf$ca$1@gellyfish.btinternet.com>

On Fri, 04 Dec 1998 05:12:27 GMT miko@idocs.com wrote:
> What is the most efficient way to test if a string is in a comma delimited
> string exactly between two commas OR at the beginning OR at the end.  I've
> played around with this but can't seem to find the magic combination.  In my
> situation I can assume the fields are not quoted or have embedded commas --
> they are just all non-comma string.
> 
> Suppose, for example, that I have this comma delimited list:
> 
>       "fred,barney,betty,wilma"
> 
> Now I want to see if that list contains "barney" but not "barn" or "ba".  If
> there were commas at the start and end of the list I could say /,barney,/ but
> I hate having to add those commas (should I?, maybe that's the most efficient
> way).  Fundamentally, I don't understand how to say "followed by a comma OR
> the end of the string".

You have already been given the answer but in the spirit of TIMTOWTDI I 
thought I'd proffer an alternative:


#!/usr/bin/perl

$instring = "fred,barney,betty,wilma";

$search = $ARGV[0];

print "Found $search !\n" if (grep /$search/, split /,/,$instring );
  
Which is almost certainly less efficient than the regex approach but I'm
not in the mood for a benchmark this morning.

The only real practical advantage I can see is that it might be easier to
understand for someone who isnt so hot on regex.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Sun, 6 Dec 1998 01:43:52 -0600
From: "brad" <bradnix@geocities.com>
Subject: Running .pl and .cgi files in dos.
Message-Id: <5Aqa2.1383$w91.759341@newsread1-mx.centuryinter.net>

Would there be any possible way to simply type  myprog.cgi instead of perl
myprog.cgi in dos?

Thanks




------------------------------

Date: 6 Dec 1998 11:03:58 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Running .pl and .cgi files in dos.
Message-Id: <74doau$94$1@gellyfish.btinternet.com>

On Sun, 6 Dec 1998 01:43:52 -0600 brad <bradnix@geocities.com> wrote:
> Would there be any possible way to simply type  myprog.cgi instead of perl
> myprog.cgi in dos?
> 

It really depends on what you mean by DOS - A command prompt under NT, A DOS
box on Windows 95 or Windows 3.1 or really just plain old DOS.

NT Has the ASSOC and FTYPE commands that enable you to associate an extension
with a particular application.

Perl for Win32 has a script called pl2bat that will place a batch file wrapper
around you perl script that enables you to run it as just <myprog> .

Under 3.1 or Plain Ol' DOS you dont have either of these options however
there is no reason I can see that pl2bat shouldnt work on these platforms
its just not in the distribution.  You could also try creating a simple
batchfile that simply did:

perl myprog.pl

And if you call it myprog.bat then it would run as expected.  Alternatively
you could (and this goes for the other platforms as well) obtain the djgpp
DOS port of bash (the GNU shell) which understands and will use the

#!/bin/perl

line at the top of your script just like most Unices (except it does it in a
different way but that shouldnt worry you).

The djgpp stuff can be found at : <URL:http://www.delorie.com/>.

I have some anecdotal evidence of other more DOS like command.com replacements
that do the shebang thing as well but I have no experience of them.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Sun, 6 Dec 1998 07:54:23 -0500
From: "marshman" <nospamm@deleteme>
Subject: what sendmail under NT
Message-Id: <74dv0h$qgf$1@camel15.mindspring.com>

I'm curious,
I am from the Unix world trying to find NT info.
What are most Perl professionals using for 'sendmail' under the NT
environment?

marshman






------------------------------

Date: 6 Dec 1998 10:30:44 GMT
From: Daniel Winkelmann <danny@sg1501.chemie.uni-marburg.de>
Subject: Writing sound files with perl
Message-Id: <366A5CD4.41C6@sg1501.chemie.uni-marburg.de>

Hi,

I'm currently searching for a way to write a sound file (fex .wav) with
perl. Searching CPAN I found nothing that seemed to be able to access or
handle such files.

Has anybody else tried to do something like this or even programmed a
Module to do so ?

TIA,

	Daniel Winkelmann


------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 4367
**************************************

home help back first fref pref prev next nref lref last post