[6965] in Perl-Users-Digest
Perl-Users Digest, Issue: 590 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 9 07:17:25 1997
Date: Mon, 9 Jun 97 04:00:19 -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 Mon, 9 Jun 1997 Volume: 8 Number: 590
Today's topics:
Re: a real easy question (Bob Apthorpe)
Re: any editor for perl? (Bob Apthorpe)
Can this be done ? <alpot@ksu.edu>
Re: Can this be done ? (Tung-chiang Yang)
Re: Date Comparisons (Bob Apthorpe)
Fast Squaring with Math::BigInt spg1@ix.netcom.com
help on pipe to ftp connection (Dgenius1)
Re: Help, embeding perl in C++ (Ken Fox)
Re: How can I look for a case insensetive name?.. <perlprogrammer@hotmail.com>
Re: HOW-DO-I: Server Side Java with IIS 2.0 (Abigail)
knowing each frame URL from the server side <tashour@mars.superlink.net>
Missing operator before 0? <naegele@she.de>
Re: Newbie: How do I write to an existing file. (Abigail)
Re: Newbie: How do I write to an existing file. ( Thomas Lachlan XMS x4206 )
PERL AND TELNET <visiocad@easynet.fr>
Perl Database (Which is better) <howard.yen@mci2000.com>
Re: Problem compiling OraPerl (2build4) on HP-UX 10.01 (John D Groenveld)
Problem with IF statement, Please assist (rk)
Re: Regexp to get rid of foo without bar? (Abigail)
Regexpert's assistance required. <sfairey@metrica.co.uk>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 09 Jun 97 04:36:28 GMT
From: arclight@io.com (Bob Apthorpe)
Subject: Re: a real easy question
Message-Id: <5ng18d$d5r@news.jump.net>
In article <2ncen5.nq.ln@localhost>, tadmc@flash.net (Tad McClellan) wrote:
>Bob Apthorpe (arclight@io.com) wrote:
>: In article <01bad896$c7884300$73053cc3@surgery.powernet.co.uk>,
>: "DAVID GILMARTIN" <david@gilmartin.uk.com> wrote:
>: It's a matter of context. "_whatever_" is a scalar context; when you
evaluate
>: @something in a scalar context, you shouldn't be too surprised when you get
>: scalar(@somthing) {the number of items in the list) as a result. Since
print
>: expects a list context, it will treat @something as, well, @something.
>
>
>Ah, but print() and double quotish things are a different case.
Argh... Mea culpa. The hazards of not having a perl interpreter in the same OS
as my mail reader and assuming the problem was the common list/scalar context
problem.
"Oh, that's different. Never mind." (1)
Bob
References:
(1) - Litella, Emily c.1977
------------------------------
Date: Mon, 09 Jun 97 05:07:37 GMT
From: arclight@io.com (Bob Apthorpe)
Subject: Re: any editor for perl?
Message-Id: <5ng32r$d5r@news.jump.net>
In article <phbu5hj60k.fsf@xanadu.mcs.anl.gov>,
pusch@mcs.anl.gov (Gordon D. Pusch) wrote:
>In article <5n459g$1ie$1@mainsrv.main.nc.us>
>scott@lighthouse.softbase.com (Scott McMahan) writes:
>
>> Monty Scroggins (Monty@dhc.net) wrote:
>>
>> : Vi is really old and nauseating...
>>
>> Vi is still around because they got it right the first time and
>> nothing better has come along. (Emacs is just a bloated vi clone! :))
>
>As far as *I'm* concerned, they got everything =WRONG= the first time.
A gentle reminder that this is an ancient and unresolvable religious issue
best left between you and your /usr/bin ...
>Each and =EVERY= ``feature'' of `vi` behaves exactly the =OPPOSITE=
>of rationaly; it =ALWAYS= makes me want to throw the @#&$%$# terminal
>through the nearest window after at _most_ fifteen keystrokes, because
>the ferschlugginer thing =NEVER= does what I expect !!!
Perhaps you just aren't expecting the right things? :)
>I consider vi's name to be =remarkable= apt --- it makes me quite
>=VIolent= each and =EVERY= time I'm _forced_ to use it (because it's
>the only @$##^%# editor on the @$##^%# system). Therefore, as a matter
>of policy, I now =REFUSE= contracts from ANY customer who won't provide me
>with a gnu-Emacs working environment...
I doubt anyone will fault you for your choice in editor, not least of all
those that agree with you. Your choice in contracts is your own decision as
well - I'm happy you have enough clients to give you a choice of which jobs
you accept (and no, that isn't veiled sarcasm...[1])
Personally, my fingers aren't up to the unholy game of Twister that emacs
would inflict upon them and after years of suffering with vi, the mnemonics of
its commands have become apparent. Personally, I can't justify training my
poor bent brain to recognize the different mnemonic (underlying logic?) of
emacs, especially knowing that one mistyped Ctrl-Alt-Backspace-Cheese_Grater
could inadvertently overflow the Chicago Ship and Sanitary Canal, sell
cigarettes to four-year-olds, or collapse Albania's economy[2]. But that's
just me.
>-- Gordon D. Pusch <pusch@mcs.anl.gov>
>
>Disclaimer: I'm a consultant collaborating with Argonne researchers;
>I don't speak for ANL or the DOE --- and they *certainly* don't speak
>for =ME= !!!
Small world. I used to work with a bunch of guys from ANL. ANL's cafeteria
kicks butt. I miss Giordanno's pizza most of all...
Go in peace, and remember: TMTOWTDI,
Bob
[1] But asking what "@$##^%#" parses to is.
[2] It's been a while since I last used emacs so those features may have been
deleted (or embellished) in the later releases.
:%s/[vV][iI]/emacs/g
and ask: does the content of the orignial post _really_ change?
------------------------------
Date: Mon, 09 Jun 1997 03:09:01 -0500
From: Alok POta <alpot@ksu.edu>
Subject: Can this be done ?
Message-Id: <339BBA1D.69B7@ksu.edu>
hi,
A script that runs everytime I login to my machine and updates me of
the web pages that have a "job listing" (say) in a specific field ?
Please email to alpot@ksu.edu
------------------------------
Date: Mon, 9 Jun 1997 09:06:29 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Can this be done ?
Message-Id: <tcyangEBI3yt.y9@netcom.com>
Yes. It can be done.
For the part before 'and', post your question again in comp.unix.questions.
For the part after 'and', post your question again in the Web newsgroups.
After you get the anwer, write your own program so every time you login
to your machine, the script will updates you with any web pages that have
a 'FAQ' in its field.
==============================
Alok POta typed when the mommy tyrannosaurus found him:
: hi,
: A script that runs everytime I login to my machine and updates me of
^^^
: the web pages that have a "job listing" (say) in a specific field ?
--
Tung-chiang Yang tcyang@netcom.com
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: Mon, 09 Jun 97 05:29:46 GMT
From: arclight@io.com (Bob Apthorpe)
Subject: Re: Date Comparisons
Message-Id: <5ng4cc$d5r@news.jump.net>
In article <5mjd7h$9h5@web.azstarnet.com>,
trs@azstarnet.com (Tim Smith) wrote:
>In article <338D218F.1D73@surfr.com>, John Cokos <jcokos@ccs.net> wrote:
>>I'm trying to do a date comparison, if you can help, I'd appreciate it.
>>
>>I have an ascii file which I'm using as a "database" with the following
>>format:
>
>[ ... ]
>
>>I can access the records by using this type of code
>>$this_date = $entries[0]{'entry_date'};
>>
>>I want to be able to delete entries that are 30+ days old.
>>How do I compare the date in the record to the current date?
>
>John,
>
>You might be looking for the Time::ParseDate module. It returns the
>number of seconds since 1970, just like time() does. So, you do:
>
>my $now = time();
>my $then = parsedate($this_date);
>
>if ($now - $then > 30 * 24 * 60 * 60) {
> # delete old file
>}
A very nice person from this newsgroup pointed me at the Date::Manip module
which will robustly and tersely do what is wanted.
(off the top of my head)
use Date::Manip;
my $err;
my $delta_time = DateCalc( ParseDate($this_date), "now", \$err, 0);
$delta_time has the format (I believe) of "dY:dM:dD:dh:dm:ds" so with
judicious use of split() (or maybe a nice regex) and arithmetic, you should
get what you want.
I have noticed, however, that Date::Manip is a pretty heavy module and it
seems to take some time to load (not a lot, but it's noticeable in short
scripts on my machine). You'll want to look at it if you plan on doing more
extensive date parsing, formatting or calculation. It's made my life a lot
easier since I was told about it.
Bob Apthorpe
------------------------------
Date: Mon, 09 Jun 1997 00:21:12 -0600
From: spg1@ix.netcom.com
Subject: Fast Squaring with Math::BigInt
Message-Id: <865833423.20260@dejanews.com>
I've been playing with a mersenne prime routine (numbers of the form
2**p-1), using BigInt. I notice that getting the initial 2**p takes a long
time. What's the fastest way to do this? Can I do better than the BigInt
package's own routine?
Also, the Lucas-Lehmer test requires iterating on ((s**2)-2)%(2**p-1). Any
ideas about the fastest way to do this?
If you are not familiar with BigInt, it uses objects and overloads to
perform basic math using strings of ASCII digits (e.g., '+729'). So any
solutions that try to use 'normal' numbers needs to handle large numbers
some other way.
I also know that there is no hope and no point in running this on
interesting numbers, such as those near 2**3000000, and competing with
anything written in C or assembly. So it's just an exercise for
comparison. For example, computing ((s**2)-2)%(2**p-1) on a pentium class
PC using optimized assembly code (see www.mersenne.org) takes about
0.250 seconds on a P133, for p=2500000. I don't know what it takes on a
Sparc 10, because it takes too long (hours or days?) to do 2**p !!!
I am also looking for a description of an FFT method that makes
multiplication faster.
Email is appreciated...
-Shaun
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 9 Jun 1997 05:50:09 GMT
From: dgenius1@aol.com (Dgenius1)
Subject: help on pipe to ftp connection
Message-Id: <19970609055001.BAA21387@ladder02.news.aol.com>
help anyone....
am opening a pipe to an ftp connection by:
open(FTP, ">ftp -i $rhost") || die ....;
...
...
...
print FTP "put $file_name";
the connection works but, it doesn't seem to transfer
the whole file. it doesn't matter what the size of the file
is. i've tried from 19k to 5mb files. it just doesn't
transfer the whole file. any suggestions anyone ???
any response would be appreciated...
please also email response to amanayan@fritz.com
tx:))
------------------------------
Date: 8 Jun 1997 23:29:34 GMT
From: fox@mail.msen.com (Ken Fox)
Subject: Re: Help, embeding perl in C++
Message-Id: <5nff8v$22p@ftl.msen.com>
Nathan V. Patwardhan (nvp@shore.net) wrote:
: Larry D'Anna (ldanna@ix.netcom.com) wrote:
: : Does anyone know how to embed perl functions in C/C++? Thanks a lot.
:
: man perlembed.
You'll also want to read perlguts, perlcall and (perhaps) perlxs.
I'm working on a C++ library that makes it easier to use Perl with C++.
The library includes some pretty nice "glue" classes that hide (most of)
the gory details of calling Perl subroutines and working with Perl
data structures. You can find the latest version (in *ALPHA*) in CPAN
at: authors/id/KENFOX/perl-c++-api.0.0_2.tar.gz. I just recently uploaded
it, so if it hasn't made it to the CPAN site nearest you, you can try my
home page at: http://www.msen.com/~fox.
To call a function using the library, you do something like this:
wPerlScalar add = wPerl::run()->eval("sub { $_[0] + $_[1] }");
printf("2 + 2 = %d\n", add(2, 2).as_integer());
If you have a module you'd like to use, you do something like this:
wPerl *perl = wPerl::run();
perl->use("Sys::Hostname");
wPerlScalar hostname = perl->subroutine("hostname");
printf("hostname = %s\n", hostname().as_string());
I've got support for scalars, arrays, hashes, many operators and built-ins
and initial support for C++ templates and Perl to/from C++ object conversion.
Like lots of people have pointed out, this doesn't make your Perl code run
any faster. However, if you have a C++ program and you want to add Perl
in a few key places or perhaps as a scripting language, this library will
make it quite simple.
The current distribution includes more documentation and demos -- but
probably not as much as either you or I would like.
- Ken
--
Ken Fox, fox@vulpes.com
-------------------------------------------------------------------------
I'm on my own time now... | "Is this some sort of trick question
| or what?" -- Calvin
------------------------------
Date: Mon, 09 Jun 1997 02:54:37 -0700
From: perl guy <perlprogrammer@hotmail.com>
Subject: Re: How can I look for a case insensetive name?..
Message-Id: <339BD2DD.2A92@hotmail.com>
Hans-Georg Thien wrote:
>
> perl guy wrote:
> >
> > does anyone know how I can search case insensitively?.. for example, I
> > have it search out and match now, but only the exact case!.. for
> > example, right now, I have it open the room directories in a chat forum,
> > it searches all the rooms, to see if that name is in use, if it *is*,
> > then is tried and match the password, if the name doesn't match the
> > password, then it calls the Room Full sub, but if it does match the
> > password and name, then it's the same person, and they can get back in.
> > (these are only temp people files, because people time out or leave)..
> > then someoen else can use that name with whatever password. Anyway, it
> > works great, other then the fact that it doesn't say that the name is in
> > use if someone types in a different CaSe HaNdLe, and they can see other
> > people's private messages then.. I could make it send the private
> > messages to the person's name and shadowed password, but it's easier
> > this way.. I just don't know how to do this.. anyway, here's what's
>
> > ## Then here is where is searched the name to see if it matches the
> > password in the files.. for example, the "peoplefile" has "people
> > fields", as in |user number|name|home page|email address|password|IP
> > address|time|etc... let's say that the name is [0], and the password is
> > [2]...
> >
> > if ($name eq && $pass ne $peoplefields[2])
> >
> > &NameInUse;
> > exit(0);
> > }
> >
> > Ok. this works great, but how can I do this to search for the name and
> > password combination to see if it's already in use by someone else, even
> > if it's typed in a different CaSe!??.. any ideas?. I've tried all the
> > ways I know.. it didn't work..
>
> Sorry, I didn4t completely understand this. But there are 2 general
> solutions for non-case-sensitive matches. the first is to use the
>
> /i
>
> modifier in regulaer expressions. for example:
>
> $_="FOO";
> if (/foo/i)
> {
> #yes, - this matches
> }
>
> this tells perl to ignore differences in case. But I suppose that the
> second approach better fits your needs:
>
> transform all your strings to lowercase, THEN compare:
>
> $name =~ tr/A-Z/a-z/;
> ...
> ...
> $pass =~ tr/A-Z/a-z/;
> if ($name eq ... && $pass ... )
> {
>
> }
>
> hope this helps - hans
Hi.. Thank you (as well as all of the others that helped), but this
isn't what I needed to know. I know how to make it into one case, but I
want to avoid having to do that. Also, I know how to make it search case
inseitive (as all of you have described), but not in that manner. That
is why I rambled on for so long. There can be any name with any case,
and the only solution to the problem that I camn see right now, is, (as
you've suggested), forcing it all into one case, but I really don't want
to have to do that. This is why I am so confused. I am getting people's
simple answere's, and I really do appreciate them, but it's not ehat I
was hoping for. for example, I can't do it liek this..
the $peoplefields is the file with all the info, and the
$peoplefields[2] is the person's name.. $peoplefields[6]
and I have it say..
if ($name eq $peoplefields[2] && $password ne $$peoplefields[6])
{
call the name in use sub;
exit;
}
That works fine for someone typing the same case, but I can't get it to
say the name is in use, unless someone types the same case eactly!..
This is why I need to to search the file and see if someoen is using
that name at that time, and if so, then no matter what case (CASE, CasE,
CaSe, etc.) they type the name in, hat it will still say it's in use, no
matter what case. Otherwise, they can see the other CASE name's private
messages. I've tried this every way I know.. how I am doing it now to
see if the name is in use, works fine.. But only in the exact same
case.. I know how to use the /i command.. but that's not going to work
in my script the way it's set up.
In other words (and this is entirely wrong and stupid!). I know.. but I
need it to work *like* this.. in the same manner.. (of course THIS would
never work!)..
for instance, you cvould do this is you KNEW what the name was, do a
global insesitive match, etc..
$name =~ s/^*this\s*.*/that/ig;
If I KNEW what it was and even wanted to cut out everyone from ever
using that word ANYWHERE in their name ever. and changing it to whatever
I wanted none the less, then putting
if ($name eq "that" && $password ne "your password")
{
print sub no way;
exit;
}
It would be great if I could do something like
$name =~ s/$name/$name/ig;
making the name already be case insensative and not allowing it to be
used.. of course THAT won't work!.. I know that.. but ift would be nice
to know a way to do it..but mainly this..
I know it's not going to work.. but a way to make it work LIKE that is
what I'm looking for in something like this (or would act like this
without changes everywhere)..
if ($name eq /$peoplefields[2]/ig && $password ne $$peoplefields[6])
{
call the name in use sub;
exit;
}
Maybe sleep and a clear head would help?.
Thanks.. I just wanted to rant some more..
------------------------------
Date: Mon, 9 Jun 1997 03:01:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: HOW-DO-I: Server Side Java with IIS 2.0
Message-Id: <EBHn23.EyH@nonexistent.com>
Bear (clary@cruzio.com) wrote on 1377 September 1993 in
<URL: news:339acdb2.1239061@news.ucsc.edu>:
++ Hi, I'm tryinng to set up my web server (IIS 2.0) to run server side
++ Java.
Then you should be asking that in a server group.
Try comp.infosystems.www.servers.ms-windows.
Abigail
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: Sun, 08 Jun 1997 20:05:31 -0400
From: Thamer Ashour <tashour@mars.superlink.net>
Subject: knowing each frame URL from the server side
Message-Id: <339B48CB.F025387F@mars.superlink.net>
Hi
I have a need to have a cgi or a server program to keep a tap on
the user movement by knowing each URL he/she is on. This is done by
having a two frames, one frame will stay on static while the other can
change when the user click any link inside. The first frame will
register the URL of the second frame when the user click on a button
within the first frame. This registration action will be done on the
server.
Please send your ideas to tashour@mars.superlink.net
Thanks
------------------------------
Date: 9 Jun 1997 06:53:45 GMT
From: Ralf Naegele <naegele@she.de>
Subject: Missing operator before 0?
Message-Id: <5ng99p$e6@linde.she.de>
With same perl scripts I get the following message:
Number found where operator expected at (eval 173) line 1, near ") 0"
(Missing operator before 0?)
Line 1 looks like
#!/usr/bin/perl
After this warning the scripts are running normal.
Any idea what this message means?
Ralf
-------------------------------------------------------------------------+
+ Ralf Naegele _/_/_/ _/ _/_/_/ +
+ Softwarehaus Engelhardt _/ _/ _/ email: naegele@she.de +
+ Donnersbergweg 1 _/_/ _/_/_/ _/_/ http://www.she.de +
+ 67059 Ludwigshafen _/ _/ _/ _/ Telefon: 0621/5953-200 +
+ Xlink-PoP LU/HD/KL _/_/_/ _/ _/ _/_/_/ Fax: 0621/5953-201 +
+------------------------------------------------------------------------+
------------------------------
Date: Mon, 9 Jun 1997 03:04:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Newbie: How do I write to an existing file.
Message-Id: <EBHn89.F56@nonexistent.com>
Dick Hardcastle (dik9@desire.force9.net) wrote on 1378 September 1993 in
<URL: news:5nfghp$ai1@newsfeed2.force9.net>:
++ Hi.
++
++ I'm writing a CGI in Perl which collects data via an HTML form. I want
++ to insert this data into the file at a specific piont which will be
++ marked with something like <!--Insertion Piont--> or a similar marker.
++ My problem is that I don't know how to search a file or how to write
++ to a specific piont in a file using Perl.
A way to do it:
Open the file for read/write.
Lock file.
Read in the file.
Modify the content.
Seek to beginning.
Write new content.
Truncate to new length.
Close file.
Abigail
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: 9 Jun 1997 10:20:47 GMT
From: etltsln@etlxd30.ericsson.se ( Thomas Lachlan XMS x4206 )
Subject: Re: Newbie: How do I write to an existing file.
Message-Id: <5ngldv$btd@newstoo.ericsson.se>
Dick Hardcastle (dik9@desire.force9.net) wrote:
: Hi.
: I'm writing a CGI in Perl which collects data via an HTML form. I want
: to insert this data into the file at a specific piont which will be
: marked with something like <!--Insertion Piont--> or a similar marker.
: My problem is that I don't know how to search a file or how to write
: to a specific piont in a file using Perl.
open(GIVEN_FILE,"</path/filename") ||
die "Can't open file" $!;
open(TEMP_FILE,">>/tmp/tmpfile")
|| die "Can't open file" $!;
while ($line=<GIVEN_FILE>) {
SWITCH: {
/'insertion label'/ && do {
print TEMP_FILE "text etc. for insertion\n";
};
/'!not insertion line'/ && do {
print TEMP_FILE "$line\n";
};
}
}
close(GIVEN_FILE);
close(TEMP_FILE);
`/bin/mv /tmp/tmpfile /path/filename`;
Hi the above is a fairly crude way in which you could go
about solving your problem.
Hopefully somebody else will post a more elegant solution.
Anyway I hope this gives you an idea.
Regards Tam
------------------------------
Date: 9 Jun 1997 10:50:18 GMT
From: "CAD-VISIOGRAPH" <visiocad@easynet.fr>
Subject: PERL AND TELNET
Message-Id: <01bc74c2$aa397160$3c5c72c3@visiocad.easynet.fr>
can I execute a Telnet with PERL and giving automaticaly the username and
the password ?
------------------------------
Date: Mon, 09 Jun 1997 02:27:19 -0700
From: Howard Yen <howard.yen@mci2000.com>
Subject: Perl Database (Which is better)
Message-Id: <339BCC77.5215@mci2000.com>
I need to develop a site that will have hundreds of thousands
of users. Currently the site is done using Perl.
Which of these 3 is the best way to go, in terms of speed,
expandability and using the least memory.
1. Msql
2. DB_File
3. Sprite
hy
------------------------------
Date: 8 Jun 1997 23:14:47 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Problem compiling OraPerl (2build4) on HP-UX 10.01
Message-Id: <5nfsf7$lkb$1@tholian.cse.psu.edu>
Keywords: oraperl
In article <5n9voq$104q$1@pulp.ucs.ualberta.ca>,
Zoran Cvetkovic <zcvetkov@gpu1.srv.ualberta.ca> wrote:
>We are trying to compile the OraPerl 2build4 using:
> - Perl 4.0.37, and
> - ORACLE 7.3
Fetch a support release of Perl (5.004) and the supported modules DBI,
DBD-Oracle from CPAN. The included Oraperl emulation module is your best
bet. See http://www.dejanews.com for details.
Happy Oraperl'ng
John
groenvel@cse.psu.edu
------------------------------
Date: Mon, 09 Jun 1997 02:37:57 GMT
From: rkl@flexsol.co.nz (rk)
Subject: Problem with IF statement, Please assist
Message-Id: <5nfu06$n7m$1@newsource.ihug.co.nz>
I have a problem with the following piece of code.
The if statement does not work.
The idea is the the datafile is read and the row from the datafile is assigned
to @founduser if the user name which is located in @fields[0] matches a value.
The value is currently hard coded to "plexus" for the test.
Any assistance would be appreciated.
open(DATAFILE, "$data_file_path") ||
&file_open_error("$data_file_path",
"Read Database",__FILE__,__LINE__);
while(($line = <DATAFILE>))
{
unless ($line =~ /^COMMENT:/)
{
chop($line); # Chop off extraneous newline
@fields = split(/\|/, $line);
}
$temp = @fields[0];
if ($temp eq "plexus")
{
@founduser = @fields;
}
}
close (DATAFILE);
$phone = @founduser[4];
$zip = @founduser[0]; #$temp;
&edit_profile;
&search_results_footer;
}
------------------------------
Date: Mon, 9 Jun 1997 03:10:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Regexp to get rid of foo without bar?
Message-Id: <EBHnHD.FG5@nonexistent.com>
Decklin Foster (mookid@ntplx.net) wrote on 1378 September 1993 in
<URL: news:339b665a.9890913@news.ntplx.net>:
++ I would like to use a regular expression to remove any occurence of some
++ regexp (foo) that is not followed by something else (bar). I'm not sure
++ how to
++ go about this - can someone give me an example? Thanks (Cc's are
++ appreciated.)
Perl has a 'negative zero-width lookahead assertion'.
$ perl -wl
use strict;
$_ = "This is a foobar and a foo.";
s/foo(?!bar)/xyzzy/g;
print;
__END__
This is a foobar and a xyzzy.
Abigail
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: Mon, 09 Jun 1997 11:21:01 +0100
From: Simon Fairey <sfairey@metrica.co.uk>
Subject: Regexpert's assistance required.
Message-Id: <339BD90D.41C6@metrica.co.uk>
Hi,
I am trying to extract fields from a line and am wondering if it is
poosible to do in one go or am I going to have to do some fiddling
about. An example of a line might be:
item1, function1([0,11], function2() ), item2
What I want is to just extract the three entries
item1
function1([0,11], function2() )
item2
Any help would be appreciated, if its not possible then I guess I am
going to have to do something more elaborate....
Simon
------------------------------
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 590
*************************************