[7469] in Perl-Users-Digest
Perl-Users Digest, Issue: 1094 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 28 22:07:16 1997
Date: Sun, 28 Sep 97 19:00:25 -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, 28 Sep 1997 Volume: 8 Number: 1094
Today's topics:
Re: [Q] Append to last line in file? (Tad McClellan)
Re: Advanced Perl Programming - Error p. 91??? <NOSPAMmark@exodus.net>
Re: CGI, Losing query parameters. HELP! <palincss@nicom.com>
Changing frames (Dimos Raptou)
Re: Changing frames (brian d foy)
Re: Changing frames <rootbeer@teleport.com>
Columns in Perl <ddean@aracnet.net>
Re: Columns in Perl (Tad McClellan)
Re: commercial packages w/ perl? Tivoli, ClearCase, DD <merlyn@stonehenge.com>
Re: file globbing with spaces in the name (Eric)
Re: formatting output (Tom Grydeland)
Re: formatting output <rootbeer@teleport.com>
Re: help! <rootbeer@teleport.com>
Hide RESENT-TO in sendmail .... <hoffmann@takeon.com>
Re: Hide RESENT-TO in sendmail .... <rootbeer@teleport.com>
How can I make sure programs run by perl die when my pe <jong@mrc-lmb.cam.ac.uk>
Re: How to access Manual page <bholzman@mail.earthlink.net>
Re: Java CGI Post to Perl Script (Ben Reser)
Re: launch Windows 3.1 app from within Perl? (Ben Reser)
Re: Need help with syntax in perl (Ben Reser)
New-b regexp question <steppach@cybermedical.com>
Re: New-b regexp question <bholzman@mail.earthlink.net>
Re: New-b regexp question (Tad McClellan)
Newbie ques: How to concatenate two strings? (Joseph)
Re: Newbie ques: How to concatenate two strings? (Abigail)
Re: Newbie ques: How to concatenate two strings? <jgostin@shell2.ba.best.com>
Re: Perl Y2K compliance <spp@psa.pencom.com>
Re: Perl4 is *not* Y2K (was Re: Y2K) (Terje Bless)
Re: Re: Msdos version stumps perl users ! (sysadmin)
Re: system() function (Salvatore Sferrazza)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 28 Sep 1997 18:28:41 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: [Q] Append to last line in file?
Message-Id: <97pm06.7k2.ln@localhost>
Jeff Stampes (stampes@xilinx.com) wrote:
: thalerj_NOSPAM@wwa._NOSPAM.com wrote:
: : Currently I'm attempting the following:
: : open FP, "+>>$filename";
: : seek FP, 0, 0;
: : print FP, "$newtext ";
: : close FP;
: : But it's still printing the newtext on a new line at the end.
: I doubt it.
: Do you realize that with that seek statement, you are setting
: the file pointer to the BEGINNING of the file?
: Why is everyone so determined to avoid temporary storage, and
: want to edit files in place?
Because they don't really know how their filesystem works?
: You want to append to the last line? Why not something like:
: open THIS, "+<$filename" or die $! ## open for read/write
: ## without clobbering
: my @array = (<THIS>); ## Slurp it into an array
^ ^
don't need those parenthesis...
: chomp $array[-1]; ## Take the newline off the last line
: $array[-1] .= "## a comment\n"; ## append a comment to the end
:
: seek THIS,0,0; ## File pointer to the beginnine
Since you are only adding chars, and the file is bound to be longer than
the original, this works fine.
But in the general case, where the new file may be shorter than the old
one, you will want a call to truncate() in here...
: print THIS @array; ## Dump it to the file
: close THIS; ## Close it
: Of course, if this is data you consider important, this is not
: an adequate routine. If it's truly important, you would make
: a backup copy first, and have a signal handler be prepared to
: restore the backup if the program was interrupted while the file
: is open.
You are right.
It is *a lot* of trouble to get in-place edits done correctly.
It is *way* easier, and quicker to code, to just use a temp file.
Some Impatience and Laziness is called for here ;-)
I don't think I'd go with all that putting it into an array stuff though:
----------------
#!/usr/bin/perl -w
undef $/; # set slurp mode
$_ = <DATA>; # slurp
s/$/new stuff/; # tack stuff onto the end, but *before* the last newline
print;
__DATA__
line one
line two
line three
----------------
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 28 Sep 1997 14:44:17 -0700
From: Mark Tripod <NOSPAMmark@exodus.net>
Subject: Re: Advanced Perl Programming - Error p. 91???
Message-Id: <342ECFB1.3C93@exodus.net>
The 'use' statement looks for a filename with a .pm extension no the
included package names.
Hope this helps clarify,
Mark
Ronjeet Lal wrote:
>
> Hi,
>
> I am reading "Advanced Perl Programming" from O'Reilly & Assoc. I think
> I found an error on p.91. However, I am not very good with modules and
> it may not be an error. Anyway...
>
> In the book on p. 91, they have
>
> package BankAccount;
> use Exporter;
> <snip>
> sub deposit {...}
> <snip>
>
> Later they have the line,
>
> use Account ('deposit');
>
> Should the "use Account" lines be "use BankAccount" since the package
> name is BankAccount?
>
> Thanks,
> Ron
> rsl3047@unix.tamu.edu
------------------------------
Date: Thu, 25 Sep 1997 07:31:22 -0700
From: Steve Palincsar <palincss@nicom.com>
Subject: Re: CGI, Losing query parameters. HELP!
Message-Id: <342A75B9.70C0@nicom.com>
George Torres wrote:
>
> I have a problem with losing query parameters when performing a button
> action.
>
> The first thing I do is let the user select from two radio buttons which
> are stored in the query. They click a button to continue.
So your form invokes a CGI script (which might or might not be Perl)
and gives it the value you got from your radio button. You then
blow back a new form for them, presumably that doesn't include the
information gathered from the radio button in the first form as a
hidden field in the new form. Your CGI then quits, dies, and
all memory that it ever ran at all is lost.
> The user then gets to choose some information from popup_menus according
> to the previous radio button information that was chosen.
> I can access the query parameters that were entered at the radio buttons
> fine at this
> point since I can display it on the page.
In other words, you used this information to generate some text, but did
not include it as a form value so when it comes time to submit the
data from this second form to a CGI, there's no way the 2nd CGI
would know anything about that data.
> The problem is, I then have the user submit the new popup_menu
> information by clicking
> yet another action button but this causes me to lose the query
> information input from
> the radio button.
>
> What the heck has happened to the data?!?!
Obvious answer: it was never part of the second form. You need
to include it in the form (typically done as hidden fields)
for it to ever get to your second CGI script.
> Any help is greatly appreciated!
Hope that helped. Now for the obligatory reminder that this was a
CGI question, not a Perl question. It wouldn't have made any
difference if your CGI's had been written in python or shell script
or awk.
Steve Palincsar
(No point including my email address, because my ISP hasn't had
a mail server available for me for the past week!)
------------------------------
Date: 28 Sep 1997 15:57:24 -0400
From: draptou@interlog.com (Dimos Raptou)
Subject: Changing frames
Message-Id: <60mcr4$qth@shell1.interlog.com>
Hello,
If you have two frames: "left" and "right". The "left" frame
contains several URLS in a pull-down menu which then runs a redirecting
script. Right now, the URL that the user clicks on appears in the
"left" frame. Is it possible for the user to click on something (which
links to a URL) in the "left" frame so that the web page appears in
the "right" frame.
I have written a Java program that handles this very nicely but I do
not know how to do it in Perl. Any help would be much appreciated.
Thanks in advanced!
------------------------------
Date: Sun, 28 Sep 1997 18:44:35 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Changing frames
Message-Id: <comdog-ya02408000R2809971844350001@news.panix.com>
In article <60mcr4$qth@shell1.interlog.com>, draptou@interlog.com (Dimos Raptou) wrote:
> If you have two frames: "left" and "right". The "left" frame
>contains several URLS in a pull-down menu which then runs a redirecting
>script. Right now, the URL that the user clicks on appears in the
>"left" frame. Is it possible for the user to click on something (which
>links to a URL) in the "left" frame so that the web page appears in
>the "right" frame.
Perl doesn't know how to do this, but the browser might.
* in your redirection script, send a Window-Target header.
See the CGI Meta FAQ for references to resources about working
with frames.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 28 Sep 1997 17:21:34 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dimos Raptou <draptou@interlog.com>
Subject: Re: Changing frames
Message-Id: <Pine.GSO.3.96.970928171852.19561G-100000@usertest.teleport.com>
On 28 Sep 1997, Dimos Raptou wrote:
> Is it possible for the user to click on something (which
> links to a URL) in the "left" frame so that the web page appears in
> the "right" frame.
If this is possible, it's a feature specific to browsers which support
frames. (In particular, it's not part of Perl.) Your Perl script would
simply need to output the right commands to tell the browser what to do.
To find out what commands to send, check with the docs and FAQs for the
browser, or ask in a browser-related newsgroup, which should be able to
give you a better and more complete answer than we can here. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sun, 28 Sep 1997 19:28:51 -0400
From: Dean Dixon <ddean@aracnet.net>
Subject: Columns in Perl
Message-Id: <342EE833.C11731A@aracnet.net>
You know how in awk you can use NF to get the number or fields or
columns
How can I do this in Perl
Help is much appreciated
Dean
------------------------------
Date: Sun, 28 Sep 1997 19:34:53 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Columns in Perl
Message-Id: <d3tm06.903.ln@localhost>
Dean Dixon (ddean@aracnet.net) wrote:
: You know how in awk you can use NF to get the number or fields or
: columns
: How can I do this in Perl
You write it in awk, then run it through a2p, then look at the output ;-)
May not be idiomatic Perl, but it is much faster than Usenet...
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Sep 1997 16:14:21 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: rs@lucent.com
Subject: Re: commercial packages w/ perl? Tivoli, ClearCase, DDTS, ... :-)
Message-Id: <8craa96ng2.fsf@gadget.cscaper.com>
>>>>> "Richard" == Richard A Stewart <ras1@mtras1.mt.lucent.com> writes:
Richard> Are there any lists of commercial packages that formally
Richard> include and/or utilize perl? Could folks please post
Richard> such lists (URL's) or the names of other packages like
Richard> Tivoli, ClearCase & DDTS that now include & use perl.
This is one of the projects that the Perl Institute (www.perl.org) has
already taken on... if you want to contribute, I'd check there first.
The Perl Institute -- helping people help Perl to help people.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 337 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 28 Sep 1997 19:48:59 GMT
From: pojo@gte.net.nospam (Eric)
Subject: Re: file globbing with spaces in the name
Message-Id: <60mcbb$ogj$1@gte1.gte.net>
>I'm writing a recursive routine that will walk down a directory structure
>deleting files and sub directories.
>
>I'm trying to make this work on both Unix and Win32.
Here's a similar routine -- recursively reads a dir structure and returns all
FILES found. Returns directory names prepended to the names. Finds all the
files in the tree, but you'll never see an empty directory unless there's
another directory beneath it that contains files. I'm sure this could be
modified for your purposes. Removing the 'splice' function would do this,
though you'd also get all of the . and .. directories. Uses
opendir/readdir/closedir rather than globbing.
--------------------------------------------------------------------------------------------------------------------
sub get_dir_struct
{
my (@list,$base_dir,$r);
$base_dir = $_[0]; # Strip off ending /
$base_dir =~ s/(.*)\/$/$1/;
if (!(opendir DIR,$base_dir)) # read all files & subdirs in
dir
{return undef;} #
@list = readdir(DIR); #
closedir (DIR); #
for ($r=0;$r <scalar(@list);$r++)
{
if ($list[$r] !~ /[\/\\]+/) # if !(/ or \ found) {insert path}
{$list[$r] = $base_dir ."/". $list[$r];} #
if (-d $list[$r]) # Deal with directories
{ #
if ($list[$r] !~ /\.{1,2}$/) ## If ! (. or ..) {read dir}
{push @list, get_dir_struct($list[$r]);} ##
splice (@list,$r--,1); ## Delete directory entries from list
}
}
return @list;
}
------------------------------
Date: 28 Sep 1997 20:00:50 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: formatting output
Message-Id: <slrn62tdri.nci.Tom.Grydeland@mitra.phys.uit.no>
On Sun, 28 Sep 1997 10:52:55 -0700,
Tom Phoenix <rootbeer@teleport.com> wrote:
> I find your question to be a little incoherent, but I think you're asking
> how you can put variable-width strings into a fixed-width report. You may
> do this by combining printf and sprintf, something like this.
>
> printf "%-20s %-20s %-20s %-20s",
> "Proj1",
> sprintf("%d (%.2f)", 100, 90),
> 89,
> sprintf("%d (%.2f)", 1024, 80);
What about formats? I'd think those to be ideal for this:
format STDOUT=
@<<<<<<<<<<<< @###.## @###.## @###.##
$name, $amount1,$amount2,$amount3
.
> Tom Phoenix http://www.teleport.com/~rootbeer/
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Sun, 28 Sep 1997 17:10:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tom Grydeland <Tom.Grydeland@phys.uit.no>
Subject: Re: formatting output
Message-Id: <Pine.GSO.3.96.970928170647.19561C-100000@usertest.teleport.com>
On 28 Sep 1997, Tom Grydeland wrote:
> Tom Phoenix <rootbeer@teleport.com> wrote:
> > printf "%-20s %-20s %-20s %-20s",
> > "Proj1",
> > sprintf("%d (%.2f)", 100, 90),
> > 89,
> > sprintf("%d (%.2f)", 1024, 80);
>
> What about formats? I'd think those to be ideal for this:
>
> format STDOUT=
> @<<<<<<<<<<<< @###.## @###.## @###.##
> $name, $amount1,$amount2,$amount3
> .
I don't think that that will generate an equivalent output format,
but you're right that formats are one way to work on this problem. I
don't think formats alone will do it, though; you'll need something
equivalent to sprintf to get what (I think) the original poster wanted.
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sun, 28 Sep 1997 17:13:07 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Anooshiravan Merat <merata@pearl.sums.ac.ir>
Subject: Re: help!
Message-Id: <Pine.GSO.3.96.970928171220.19561D-100000@usertest.teleport.com>
On 28 Sep 1997, Anooshiravan Merat wrote:
> Subject: help!
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> someone please tell me where can i find a guide about perl on the net.
http://www.yahoo.com/ Search for "perl". :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sun, 28 Sep 1997 21:03:30 -0700
From: Bodo Hoffmann <hoffmann@takeon.com>
Subject: Hide RESENT-TO in sendmail ....
Message-Id: <342F2892.B30BF095@takeon.com>
Hi!
I am try to write a prog which passes several incoming
e-mails to different pop3-accounts.
(I know that mreply is a great prog, but I need some
sepcial things which aren't be done by mreply...)
e.g.
incoming to userx@host.com ---> userx@another.com
usery@host.com ---> usery@another.com
The problem is that if I resend the message the
original TO-Field will dissapear :-( ...
I can solve this by using RESENT-TO/FROM, but then
I have a big header that I don't want to have ...
like:
Subject: test8
Resent-Date: Sun, 28 Sep 1997 20:46:57 +0200 (MET DST)
Resent-From: "Forwarder" <autobot@host.com>
Resent-To: userx@another.com
Date: Sun, 28 Sep 1997 20:46:57 +0200 (MET DST)
From: Bodo Hoffmann <hoffmann@takeon.com>
To: userx@host.com
but I just want to have something like
Subject: test8
Date: Sun, 28 Sep 1997 20:46:57 +0200 (MET DST)
From: Bodo Hoffmann <hoffmann@takeon.com>
To: userx@host.com
which will be pass to userx@another.com
ANY IDEA what Header will be the right one for this?
Thanks!
Ciao bodo_.........
------------------------------
Date: Sun, 28 Sep 1997 12:09:04 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Bodo Hoffmann <hoffmann@takeon.com>
Subject: Re: Hide RESENT-TO in sendmail ....
Message-Id: <Pine.GSO.3.96.970928120802.12117O-100000@usertest.teleport.com>
On Sun, 28 Sep 1997, Bodo Hoffmann wrote:
> ANY IDEA what Header will be the right one for this?
No, but the people who know about sendmail probably know. Check the
sendmail docs and FAQs, and if you still can't find the answer, try asking
in a sendmail newsgroup. People there should be able to give you better
and more complete answers about sendmail than we can here. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 29 Sep 1997 00:09:12 +0100
From: Jong <jong@mrc-lmb.cam.ac.uk>
Subject: How can I make sure programs run by perl die when my perl dies?
Message-Id: <342EE398.2781@mrc-lmb.cam.ac.uk>
Hi,
I notice that a program which I run within perl
scripts (using backtick or system command) still
runs on even though perl died.
Is there any elegant way to make sure all the
programs run by perl killed immediately when
perl program is killed?
Thanks a lot.
Jong
--
I support Perl, Linux ...
With OVER SIX MILLION USERS, up from only ten or so a very few years
ago, Linux has taken it's place as the world's #3 computer operating
system overall. And Linux is breathing down the neck of #2 for very good
reasons. If growth rate to date continues, Linux will be the #1 computer
operating system by late '98 or '99. Are YOU ready?
) Linux Newsletter
http://www.smli.com/people/john.ousterhout/scripting.html
Tel: lab: 01223 402479, or 01223 402235, home: 01223 515127
------------------------------
Date: Sun, 28 Sep 1997 20:08:35 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: kinlam <kinlam@mec.cuny.edu>
Subject: Re: How to access Manual page
Message-Id: <342EF183.784DC0D1@mail.earthlink.net>
[posted & mailed]
kinlam wrote:
>
> Hi :
> I have just install perl on AIX , and I note it that there are some
> manual doc.
> that come with it, Can anyone help to access it
>
> Kin
> e-mail : kin@mec.cuny.edu
Try 'man perl' which should lists the different documentation sections
available. For each section, you can do 'man <section_name>', like 'man
perlop' for a description of the operators in Perl. If 'man' reports
that it can't find anything, your MANPATH environment variable needs to
have the directory in which perl installed the man pages added to it.
This was chosen during the configuration process, and probably defaulted
to '/usr/local/man'.
Alternatively, you can use 'perldoc' instead of 'man', as perldoc will
automagically know where the perl man pages are. You can also get
documentation on specific functions by doing 'perldoc -f
<function_name>'.
Hope this helps!
Benjamin Holzman
------------------------------
Date: Sun, 28 Sep 1997 20:50:21 GMT
From: ben@reser.org (Ben Reser)
Subject: Re: Java CGI Post to Perl Script
Message-Id: <342ec2d6.8726588@192.168.0.1>
You might want to refer to the following references to help you:
The Idiot's Guide to Solving Perl CGI Problems
http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html
Perl CGI Programming FAQ
http://www.perl.com/CPAN-local/doc/FAQs/cgi/perl-cgi-faq.html
On Sun, 28 Sep 1997 16:13:46 GMT, peterpan@mailexcite.com (Peter)
wrote:
>Hello All,
>
>I write a Java applet to POST some data to a server
>script and that script will send back what I post to it. When I use a
>compiled C script, all things work fine. but when I use a PERL script
>to replace that C script. I encounter a "Server Error 500" IO
>exception that produce from the server. Anybody know what's wrong?
> I have tested my script under debug mode and find it ok. The
>following is my script:
>
>#!/usr/local/bin/perl
>
>use CGI qw(:standard);
>
>$query = new CGI;
>
>$yourname = $query->param('name');
>$youremail = $query->param('email');
>
>print header();
>print start_html();
>print $yourname;
>print $youremail;
>print end_html();
************************* IMPORTANT *************************
Why the new email address you ask?
Simple, I'm attempting to simplify the way I filter my mail.
Please direct all personal mail to ben@reser.org
Not directing personal mail to this address may cause
delays in me reading your mail or may even get it deleted.
************************ IMPORTANT *************************
---
Ben Reser <ben@reser.org>
http://ben.reser.org
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d-(+)@ s:- a-- C++++$ UBVC++++(++)$ P+++$>++++ L- !E---- W@ N(+)>++ o? K--? w++$@>+++ !O---- !M V PS+(++)@>+++ PE++(+++)@ Y+(++)@ PGP+(++)>+++ t+()@ 5 X !R tv-(+)@>-- b+(++)>+++ DI++ D G e h++ r-()>+++ y?
------END GEEK CODE BLOCK------
------------------------------
Date: Sun, 28 Sep 1997 20:45:08 GMT
From: ben@reser.org (Ben Reser)
Subject: Re: launch Windows 3.1 app from within Perl?
Message-Id: <342ec1bc.8444222@192.168.0.1>
Use this line:
system("c:\windows\minesweep.exe");
On 28 Sep 1997 04:14:44 GMT, willey@purdue.edu (Mark Willey) wrote:
>Hi, All.
>
>Can't find this in any FAQ:
>
>Is there a way to launch a Windows 3.1 app from within a Perl script?
>Something like minesweep.pl that would launch minesweeper, for example. Or
>is there any general utility program that would do that which I could
>invoke from said perl script?
>
>Mark
>
************************* IMPORTANT *************************
Why the new email address you ask?
Simple, I'm attempting to simplify the way I filter my mail.
Please direct all personal mail to ben@reser.org
Not directing personal mail to this address may cause
delays in me reading your mail or may even get it deleted.
************************ IMPORTANT *************************
---
Ben Reser <ben@reser.org>
http://ben.reser.org
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d-(+)@ s:- a-- C++++$ UBVC++++(++)$ P+++$>++++ L- !E---- W@ N(+)>++ o? K--? w++$@>+++ !O---- !M V PS+(++)@>+++ PE++(+++)@ Y+(++)@ PGP+(++)>+++ t+()@ 5 X !R tv-(+)@>-- b+(++)>+++ DI++ D G e h++ r-()>+++ y?
------END GEEK CODE BLOCK------
------------------------------
Date: Sun, 28 Sep 1997 20:48:18 GMT
From: ben@reser.org (Ben Reser)
Subject: Re: Need help with syntax in perl
Message-Id: <342ec226.8550424@192.168.0.1>
As another poster said use /$ARGV[0]/
However, I might also point out that if your calling this regular
expression more than once you'll want to use /$ARGV[0]/o
This prevents perl from recompiling the regular expression everytime
you use it. Since the command line (unless you write to $ARGV[0])
isn't going to change this is a smart move and will make your program
much faster.
On 28 Sep 1997 14:43:04 GMT, masroor <masroor@bga.com> wrote:
>
>Hi ::
>
>1) /Hello/
>
>Question , In the above statment I am searching for the word hello.
> What would be syntax, if I wanted to pass a command line
> argument, that way it will search for the strinmg that is
> passed by the argument.
> I have tried the followings and they didn't work.
>
> 1) /\$1/
> 2) /\$ARGV\[0\]/
> 3) /$ARGV\[0\]/
>
>ANy help would be appreciated.
>
>Thanks
>Masroor
>
>email ===> masroor@bga.com
>
************************* IMPORTANT *************************
Why the new email address you ask?
Simple, I'm attempting to simplify the way I filter my mail.
Please direct all personal mail to ben@reser.org
Not directing personal mail to this address may cause
delays in me reading your mail or may even get it deleted.
************************ IMPORTANT *************************
---
Ben Reser <ben@reser.org>
http://ben.reser.org
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d-(+)@ s:- a-- C++++$ UBVC++++(++)$ P+++$>++++ L- !E---- W@ N(+)>++ o? K--? w++$@>+++ !O---- !M V PS+(++)@>+++ PE++(+++)@ Y+(++)@ PGP+(++)>+++ t+()@ 5 X !R tv-(+)@>-- b+(++)>+++ DI++ D G e h++ r-()>+++ y?
------END GEEK CODE BLOCK------
------------------------------
Date: Sun, 28 Sep 1997 17:09:22 -0400
From: Robert Steppacher <steppach@cybermedical.com>
Subject: New-b regexp question
Message-Id: <60mgpq$ggf@bgtnsc03.worldnet.att.net>
Hello I have seen the following regexp used to help secure user imput
whent it is being used to do somthing in a CGI script:
unless($recipient =~ /^[\w@\.\-]+$/) {
# Print out some HTML here indicating failure
exit(1);
}
I sniped this from
http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt.
I understand the concept of what is happening here, but I would like to
know what exactly does /^[\w@\.\-]+$/ match.
TIA,
Robert Steppacher
------------------------------
Date: Sun, 28 Sep 1997 17:29:23 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: steppach@cybermedical.com
Subject: Re: New-b regexp question
Message-Id: <342ECC33.AC9F948B@mail.earthlink.net>
[posted & mailed]
Robert Steppacher wrote:
>
> Hello I have seen the following regexp used to help secure user imput
> whent it is being used to do somthing in a CGI script:
>
> unless($recipient =~ /^[\w@\.\-]+$/) {
> # Print out some HTML here indicating failure
> exit(1);
> }
>
> I sniped this from
> http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt.
>
> I understand the concept of what is happening here, but I would like to
> know what exactly does /^[\w@\.\-]+$/ match.
> TIA,
> Robert Steppacher
Check out the perlre manpage for complete info on regular expressions,
and what all the symbols mean. Here's what the regexp in question
matches:
/^ # This anchors the match at the beginning of the string
[ # Begin character class, which contains:
\w # alphanumerics (libc's isalpha)
@ # a literal @ character
\. # a literal . character (. by itself is any character)
\- # a literal - character.
]+ # end of class, quantified by '+', meaning one-or-more
$ # anchors match at end of string
/x # The 'x' allows these comments.
It looks like this is intended to match an e-mail address, but before
Randall can flame me, let me point out that there are valid email
addresses for which this pattern will _not_ match. If you're going to
be passing an e-mail address to another process (like, say, sendmail),
you should read
http://www.perl.com/CPAN-local/doc/FMTEYEWTK/safe_shellings
which shows how to transcend the shell.
Hope this helps!
Benjamin Holzman
------------------------------
Date: Sun, 28 Sep 1997 18:15:11 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: New-b regexp question
Message-Id: <vdom06.0i2.ln@localhost>
Robert Steppacher (steppach@cybermedical.com) wrote:
: I understand the concept of what is happening here, but I would like to
: know what exactly does /^[\w@\.\-]+$/ match.
^ ^
^ ^ neither of these need to be backwacked...
It matches a string consisting entirely of only these characters:
(from \w)
a-z
A-Z
0-9
_ # underscore
(included in the character class)
@ # at sign
. # dot
- # hyphen
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 29 Sep 1997 00:42:15 GMT
From: jglosz@san.rr.com (Joseph)
Subject: Newbie ques: How to concatenate two strings?
Message-Id: <342ef7e2.3471608@news-server>
I know this has GOT to be the ultimate newbie question, but I don't
know perl, and I need to modify an existing script, which processes a
form and sends the contents of the fields in an email.
I want to concatenate the string values of the NAME and VALUE pair so
that the VALUE has the "Name" in it as well. Is it something as simple
as
$value = $name + $value;
I'm going to put something like "{CustomerName}" in $name, and the
$value will have whatever the user types in the html form, so the
result should look like
"{CustomerName}Johnny B. Goode" ....
But as it is, the perl program just loops through using a "foreach"
and does a "print MAIL" for each form value. So if Ijust modify the
value ahead of time, then this should work...
Am I right?
Thanks in advance...
------------------------------
Date: 29 Sep 1997 01:34:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <slrn62u1gp.565.abigail@betelgeuse.rel.fnx.com>
Joseph (jglosz@san.rr.com) wrote on 1490 September 1993 in
<URL: news:342ef7e2.3471608@news-server>:
++ I know this has GOT to be the ultimate newbie question, but I don't
++ know perl, and I need to modify an existing script, which processes a
++ form and sends the contents of the fields in an email.
Perhaps you shouldn't modify a program in any language if you
don't know the language.
"Hey Doc, this has GOT to be the ultimate newbie question, but I don't
know medication, and I need to fix the lung I'm dealing with while
operating on my kid."
++ I want to concatenate the string values of the NAME and VALUE pair so
++ that the VALUE has the "Name" in it as well. Is it something as simple
++ as
++
++ $value = $name + $value;
Yeah, something simple as that. And you find the answer by doing something
simple as:
$ man perlop | grep concatenate
Abigail
------------------------------
Date: 29 Sep 1997 01:37:10 GMT
From: Jeff Gostin <jgostin@shell2.ba.best.com>
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <60n0o6$1po$1@nntp1.ba.best.com>
Joseph <jglosz@san.rr.com> wrote:
: I want to concatenate the string values of the NAME and VALUE pair so
: that the VALUE has the "Name" in it as well. Is it something as simple
: as
: $value = $name + $value;
>From another relative newbie, here's the easy way:
$value = $name . $value;
"." is the concatenatation operator. It takes the leftside value (lvalue)
and appends the rightside value (rvalue) to it, returning (lvalue)(rvalue).
--Jeff
------------------------------
Date: 27 Sep 1997 12:44:53 -0500
From: Stephen Potter <spp@psa.pencom.com>
Subject: Re: Perl Y2K compliance
Message-Id: <uuzpoyk5wq.fsf@psa.pencom.com>
[Comp.lang.perl is dead. Please use comp.lang.perl.misc]
Ed Mulligan <ed_mulligan@swissbank.com> writes:
> Can anyone tell me if perl 5.003 or 5.004 are year 2000 compliant? If
> they are not, does anyone know what version will be compliant and when
> it will be available?
As the perl FAQ (section 4) states:
Does Perl have a year 2000 problem?
Not unless you use Perl to create one. The date and time functions
supplied with perl (gmtime and locatime) supply adequate information to
determine the year well beyond 2000 (2038 is when trouble strikes). The
year returned by these functions when used in an array context is the year
minus 1900. For years between 1910 and 1999 this happens to be a 2-digit
decimal number. To avoid the year 2000 problem simply do not treat the
year as a 2-digit number. It isn't.
-spp
------------------------------
Date: Mon, 29 Sep 1997 03:25:53 +0200
From: link@tss.no (Terje Bless)
Subject: Re: Perl4 is *not* Y2K (was Re: Y2K)
Message-Id: <link-2909970325530001@news.uit.no>
In article <8c3emp8swu.fsf_-_@gadget.cscaper.com>,
Randal Schwartz <merlyn@stonehenge.com> wrote:
>Let's start a rumor that 4.036 is *not* Y2K-compliant! Yes!
Waddaya mean "rumor"? Perl 4.036 *isn't* Y2K compliant[0].
--
[0] - This of course because it doesn't come with a big red sign that tell
you to use '$year += 1900' and not '19$year'. :-)
------------------------------
Date: 29 Sep 1997 00:55:18 GMT
From: nobody@nowhere.com (sysadmin)
Subject: Re: Re: Msdos version stumps perl users !
Message-Id: <60mu9m$9la@newsserver.trl.OZ.AU>
In response to:
***
Roy Morris wrote in message <342C372A.E6758807@cgocable.net>...
I am very surprised that no one has come across this problem
before the system("command"); function must be one of the most
common functions know to man. let me try this again. I am calling
a system("cls"); function under the MsDos version of perl. This
function does not seem to operate under this version. I performs
as expected under win95/nt Ntvdm and command sessions.
Has anyone run across this problem yet ?
***
My understanding is that cls is an internal command to command.com and must
be invoked using system( "command.com /c cls").
------------------------------
Date: Mon, 29 Sep 1997 00:46:45 GMT
From: salvatore_sferrazza@baruch.cuny.edu.removethis (Salvatore Sferrazza)
Subject: Re: system() function
Message-Id: <342efa28.600596001@sleepy.inch.com>
On Thu, 25 Sep 1997 00:30:19 -0400, Roy Morris <rmorris@cgocable.net>
wrote:
> The code seems to function correctly except for the "system()"
>function ?
>they are simple "cls" and prompt commands , but when I run this same pl
>file on a
>winnt , or 95 machine they work fine ..
If the OS is dos, make sure you are using dos perl, NOT perl for
win32.
HTH,
Sal
=-=-Sa|zie-=-=
salvatore_sferrazza@baruch.cuny.edu
------------------------------
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 1094
**************************************