[12279] in Perl-Users-Digest
Perl-Users Digest, Issue: 5879 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 3 16:07:24 1999
Date: Thu, 3 Jun 99 13: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 Thu, 3 Jun 1999 Volume: 8 Number: 5879
Today's topics:
Re: "cat"-ing three files into three files. <hasant@trabas.co.id>
Re: Basic oraperl array question (John D Groenveld)
Re: CGI script for age verification? <rootbeer@redcat.com>
Re: CGI Scripting to a database <gregm@well.com>
Re: CGI Scripting to a database (Jason Murray)
DBI vs ODBC?? <REMOVENOSPAMwmtoh@singnet.com.sg>
Re: Easy /bin/sh but Perl not (Greg Bacon)
Help with my SWITCH statement.. <portboy@home.com>
Re: Help with my SWITCH statement.. <rootbeer@redcat.com>
Re: how to track users (w/out cookies) and write to the <rootbeer@redcat.com>
Re: miliseconds in a timestamp? <rootbeer@redcat.com>
Re: Multi-Inclusive Pattern Match (Ilya Zakharevich)
Re: Parameter passing <aqumsieh@matrox.com>
Re: Password Generator <rootbeer@redcat.com>
Re: perl -w, "uninitialized" variables, and the Perl la <hasant@trabas.co.id>
Re: Perl script keeps terminating <emschwar@rmi.net>
Re: Please help ? <hasant@trabas.co.id>
Re: Problem with Regexp (Ilya Zakharevich)
Re: Speed question... (Ilya Zakharevich)
Weird Warning from conditional <spike1965@worldnet.att.net>
Re: Weird Warning from conditional <rootbeer@redcat.com>
Re: where did I go wrong? (Larry Rosler)
Re: while (@myarr) <aqumsieh@matrox.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 4 Jun 1999 00:36:43 +0700 (JAVT)
From: Hasanuddin Tamir <hasant@trabas.co.id>
To: comp.lang.perl.misc@list.deja.com
Subject: Re: "cat"-ing three files into three files.
Message-Id: <Pine.LNX.3.96.990604003303.348B-100000@borg.intern.trabas.co.id>
On Wed, 26 May 1999 nilrame@my-deja.com wrote:
nilrame] Date: Wed, 26 May 1999 17:43:26 GMT
nilrame] From: nilrame@my-deja.com
nilrame] To: comp.lang.perl.misc@list.deja.com
nilrame] Subject: Re: "cat"-ing three files into three files.
nilrame] Reply-To: comp.lang.perl.misc@list.deja.com
nilrame] Organization: Deja.com - Share what you know. Learn what you don't.
nilrame]
nilrame] In article <87pv3ypefu.fsf@camel.cpsgroup.com>,
nilrame] Dale Henderson <dhenders@cpsgroup.com> wrote:
nilrame] >
nilrame] >
nilrame]
nilrame] [....deleted...]
nilrame] I've modified the above code to look like this
nilrame]
nilrame] close ($fh{$fname});
Can't remember where I read this, but it said something like,
"if you're going to use other than simple scalar as filehandle
variable, you have to put it in curly brace.."
close { $fh{$fname} } or die "Can't close: $!";
-hasan-
+================================================================+
Hasanuddin Tamir <hasant@trabas.co.id>
TRABAS Technical Dept. PT Meitraco Bahana Sejahtera
IT Solution Provider http://www.trabas.co.id/
Surya Sumantri Blok B1 No. 35 Phone: +62-22-216660
Setrasari Mall Bandung 40146 Fax : +62-22-2007633
+================================================================+
SORRY: I ignore most of attachments but plain text type
+================================================================+
"Mangga, tong era-era... tapi tong rea-rea teuing."
--Iman, ja'i
------------------------------
Date: 3 Jun 1999 15:06:24 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Basic oraperl array question
Message-Id: <7j6jng$fik$1@hubsch.cse.psu.edu>
In article <KTx53.667$m4.3117@nntp1>,
Jared Hecker <jhecker@iago.nac.net> wrote:
>Nothing in the Oraperl docs refers to this and I feel like I am writing
>way too many cursors and fetches to do something like this.
perldoc Oraperl
ora_fetch
Used in an array context, the value returned is an array
containing the data, one element per field. Note that this
will not work as expected:
If you switch from the emulation module to DBI, you can access those
values in a multitude of ways. See perldoc DBI
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect("dbi:Oracle:", "scott", "tiger", {RaiseError=>1});
my $sth = $dbh->prepare("SELECT ename, empno FROM emp");
$sth->execute();
#
my ($ename, $empno);
$sth->bind_columns(undef, \($ename, $empno));
while ($sth->fetchrow-arrayref) {
print $ename, $empno;
}
## or
#my @row;
#while (@row = $sth->fetchrow_array) {
# print $row[0], $row[1];
#}
## or
#my $row_ref;
#while ($row_ref = $sth->fetchrow_hashref) {
# print $row_ref->{"ENAME"}, $row_ref->{"EMPNO"};
#}
$sth->finish;
$dbh->disconnect;
>If it is convenient, e-mail will reach me faster.
While faster and more convenient for you, email does nothing to help save
the world by sharing our answers and allowing them to be archived.
John
groenveld@acm.org
------------------------------
Date: Thu, 3 Jun 1999 12:30:39 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: CGI script for age verification?
Message-Id: <Pine.GSO.4.02A.9906031227030.22017-100000@user2.teleport.com>
On 3 Jun 1999, HUY4HUY wrote:
> Subject: CGI script for age verification?
If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service.
> I built up a site about age verification system, but my sign-up page
> does not work. My web address and email adress for that is:
>
> http://www.ridinghigh.com
> ktansel@hotmail.com
>
> My site provider told me that I need a cgi script in my html coding. I
> found a program provider in internet but they are selling it for $300
> that I can not afford now. I am a student and a new bee, I know almost
> nothing about programming languages yet.
>
> If someone has a spare time and help me for that I will be gratefull.
I don't see any question here, so I'm not sure what you're asking. But if
you're trying to verify that a remote human has orbited the sun a certain
number of times, well, I've never seen a protocol which does that
reliably - whether implemented by Perl or by Bouncer. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 03 Jun 1999 12:02:28 -0700
From: Greg McCann <gregm@well.com>
Subject: Re: CGI Scripting to a database
Message-Id: <3756D144.5C659782@well.com>
paulm@dirigo.com wrote:
>
> I'm currently in the process of setting up our database to be web
> enabled. Does anyone know of a place where I can get an idea of how to
> write CGI scripts to query a database via ODBC?
http://www.roth.net/perl/odbc/
--
======================
Gregory McCann
http://www.calypteanna.com
"Be kind, for everyone you meet is fighting a great battle." Saint Philo of
Alexandria
------------------------------
Date: Thu, 3 Jun 1999 13:08:06 -0600
From: lather@electrografix.com (Jason Murray)
Subject: Re: CGI Scripting to a database
Message-Id: <08AE464C88D6D2118BC30008C79FE1738FB85E@news.corp.es.com>
In article <7j61k6$fvn$1@nnrp1.deja.com>,
paulm@dirigo.com writes:
> I'm currently in the process of setting up our database to be web
> enabled. Does anyone know of a place where I can get an idea of how to
> write CGI scripts to query a database via ODBC?
>
> --
> Paul R. Mesker
> System Engineer
> Dirigo Inc.
>
Greetings,
You could try CGI.pm and DBI.pm in the same script.
Regards,
Jason
------------------------------
Date: Sat, 5 Jun 1999 03:41:25 +0800
From: "Luke" <REMOVENOSPAMwmtoh@singnet.com.sg>
Subject: DBI vs ODBC??
Message-Id: <7j6mde$v0t$1@violet.singnet.com.sg>
Hi,
Could someone tell me the difference between DBI and ODBC and which
method is better to use to interface a program with a database?
I'm currently programming on Windows, but want to be able to port the
code to a Unix system later on.
Luke
------------------------------
Date: 3 Jun 1999 19:28:34 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Easy /bin/sh but Perl not
Message-Id: <7j6l12$9tu$1@info2.uah.edu>
In article <7j3otq$q3s$1@news.harvard.net>,
"MDM" <michaeldmooreNOSPAM@hotmail.com> writes:
: I need to find some examples on how grep is used in Perl but from reading
: the doc I dont think it is as easy as the UNIX grep ?
To Unix, grep is a utility program. To Perl, grep is an operator.
The two perform vaguely similar functions, but you really shouldn't
confuse the two. Besides, there's already a version of grep written
in Perl: <URL:http://language.perl.com/ppt/src/grep/tcgrep>. Your
problem is that you'll need to find a halfway decent shell to use it
most effectively.
Greg
--
The depths of idiocy are as yet unplumbed.
-- Larry Wall in <199612181938.LAA10214@wall.org>
------------------------------
Date: Thu, 03 Jun 1999 19:22:49 GMT
From: Mitch <portboy@home.com>
Subject: Help with my SWITCH statement..
Message-Id: <37566636.75DB8734@home.com>
Can I do this type of check? Wher $speed should be an integer and $type
is a string.
SWITCH: {
if ($speed == 10 && $type eq "foo") { $haha = "10foo";
last SWITCH; }
if ($speed == 10 && $type eq "bar") { $haha = "10bar";
last SWITCH; }
if ($speed == 100 && $type eq "foo") { $haha = "100foo";
last SWITCH; }
if ($speed == 100 && $type eq "bar") { $haha = "100bar";
last SWITCH; }
if ($speed eq "auto") { $foo = "auto"; last SWITCH; }
$nothing = 1;
}
print "$haha\n";
When I try to print out the "haha", all I get is a blank line.
Can you tell me what I'm doing wrong here?
Thanks,
Mitch
------------------------------
Date: Thu, 3 Jun 1999 12:44:17 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Help with my SWITCH statement..
Message-Id: <Pine.GSO.4.02A.9906031241260.22017-100000@user2.teleport.com>
On Thu, 3 Jun 1999, Mitch wrote:
> Can you tell me what I'm doing wrong here?
Have you tried stepping through your code with the debugger? You can see
each line before it's executed, check on variables, and even evaluate
expressions to see what's happening. See if you can narrow it down to a
single line of code that's not doing what you expected. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 3 Jun 1999 12:04:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: how to track users (w/out cookies) and write to them individually
Message-Id: <Pine.GSO.4.02A.9906031158470.22017-100000@user2.teleport.com>
On Thu, 3 Jun 1999 mikecard@my-deja.com wrote:
> if this is a cgi question and not perl related 1,000 apologies.
To be sure, it's a web question. :-) But yes, it would be more at home in
a newsgroup about CGI programming.
> the problem i am having is how to keep multiple users in the same game
> and contact them individually.
There are some ways in a couple of Randal's Web Techniques columns,
especially columns 23 and 24, but nothing that's exactly what you need.
Maybe next issue, now that he's seen this idea. :-)
http://www.stonehenge.com/merlyn/WebTechniques/
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 3 Jun 1999 12:13:57 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: miliseconds in a timestamp?
Message-Id: <Pine.GSO.4.02A.9906031207360.22017-100000@user2.teleport.com>
On Thu, 3 Jun 1999 amidalla@my-deja.com wrote:
> I'm looking for a smaller unit than the second to write to a log file
> when an action is encountered. Currently I'm just using minutes and
> seconds: ($sec, $min) = localtime(time) ..Thanx..
It's just a hunch, but are you trying to ensure that each log entry has a
unique timestamp? Because millisecond resolution won't necessarily ensure
that....
In any case, the FAQ has some information in section eight. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 3 Jun 1999 19:38:16 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Multi-Inclusive Pattern Match
Message-Id: <7j6lj8$ghp$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Andrew Allen
<ada@fc.hp.com>],
who wrote in article <7j6eai$fva$3@fcnews.fc.hp.com>:
> kgentes@gentek.net wrote:
> : sub routine that allows me to test for a list
> : of patterns in a single string. The example I
> : saw did an "or" of the pattern list, while I
> : need to do an "and" of the patterns against
> : the string.
>
> Here's one-liner:
>
> print $line if !grep($line!~/\b$_\b/,@popstates);
>
> 'course, it's rather inefficient, since it has to compile the regexes
> every time, and doesn't short-circuit.
What is bad with
perl -wne '$" = '|'; @l = ...; print if /\b(@l)\b/o' file
?
Ilya
------------------------------
Date: Thu, 3 Jun 1999 14:43:03 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Parameter passing
Message-Id: <x3ywvxl2ki1.fsf@tigre.matrox.com>
Derek Lavine <derek@realware.com.au> writes:
> I have a function log() function that I pass a filename and a hash, it
> is called thus
>
> %fields = (
> application => "My App",
> severity => "Fatal",
> page => $ENV{HTTP_REFERER}
>
> etc.
> );
>
> &log("${site_path}/logfiles/error.log", \%fields);
You are not passing it a hash. You are actually passing a reference to
a hash. Checkout perlref, perlsub and perldsc.
> # Log looks like this
>
> sub log {
> my ($filename, $fillings) = @_;
$fillings now is a reference to %fields.
> ....
>
> # I process $fillings as
>
> while ( ($tag, $value) = each %$fillings )
^^
^^
Here, you are actually dereferencing the hash reference to gain access
to your hash.
> {
> $value =~ s/(\w+)\n/{$1}/g;
> $buff .= "$tag : $value\n";
> }
>
> # more stuff
>
> # now I want to call another function that takes a filename and a hash
>
> func2( $filename, $fillings); # this does not work, how should I pass
> 'fillings'
Why doesn't this work? It depends on what func2() expects. If it
expects a reference to a hash (like log() did), then this should be
perfectly fine. Else if it expects a hash, you will have to
dereference the hash as such %$fillings.
What makes you say it doesn't work?
> }
>
> So my question is how do I turn $fillings back in to a hash for the call
> of func2() as I want the call to func2() to be the equivalent of
>
> %fields = (
> application => "My App",
> severity => "Fatal",
> page => $ENV{HTTP_REFERER}
>
> etc.
> );
>
> &func2("${site_path}/logfiles/error.log", \%fields);
Ok .. here you are passing a reference to %fields. But $fillings *IS*
a reference to %fields. So just pass it and all will be fine. Your
code above should work. Again, I ask you, what makes you say it
doesn't work? Did you try it?
> Thanks for any help.
>
> Are there some basic rules (one liners) that can be applied to turn on
> type of variable in to another (for convert able types)?
Hmmm.. convertable types? (The image of Homer Simpson suddenly comes
to my mind here!) What do you exactly mean? Perhaps you are
just confused and need to read more docs. Have a look at the following
perldocs:
perldata
perldsc
perlref
perlsub
And all will be crystal clear. If after that you still have problems
then post again, and someone will aid you further.
> Or is there a specific place that will explain this in "Programing Perl"
> (I could not find it?)
I advise you to go to your nearest bookstore/library and checkout
"Learning Perl", by Schwartz and Christiansen, published by
O'Reilly. This book is intended more for beginners. I regard
"Programming Perl" as the ultimate reference rather than as a good
first step.
HTH,
Ala
------------------------------
Date: Thu, 3 Jun 1999 12:26:09 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Password Generator
Message-Id: <Pine.GSO.4.02A.9906031214530.22017-100000@user2.teleport.com>
On Thu, 3 Jun 1999 jatgal@my-deja.com wrote:
> Does any one know, any good perl password generators, that will
> generate easy to remember but secure passwords. Please let me know if
> you know any scripts/modules/programs for it or the best way to do it.
I wonder whether anyone cares to implement FIPS 181 as an XSUB.
http://www.p-and-e.com/pubs_FIPS.htm
http://csrc.nist.gov/fips/fips181.txt
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 4 Jun 1999 01:09:37 +0700 (JAVT)
From: Hasanuddin Tamir <hasant@trabas.co.id>
To: comp.lang.perl.misc@list.deja.com
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <Pine.LNX.3.96.990604010658.348D-100000@borg.intern.trabas.co.id>
On 26 May 1999, John Siracusa wrote:
macintsh] Date: 26 May 1999 19:32:24 GMT
macintsh] From: John Siracusa <macintsh@cs.bu.edu>
macintsh] To: comp.lang.perl.misc@list.deja.com
macintsh] Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
macintsh] Reply-To: comp.lang.perl.misc@list.deja.com
macintsh] Organization: Boston University
macintsh]
macintsh] If you only have a hammer, you tend to
macintsh] see every problem as a nail. -- Maslow
Just can't stand to say that:
If all you have is duct tape, everything
starts to look like a duct. -- Larry Wall
(from: "Perl, the first postmodern computer language")
-hasan-
+================================================================+
Hasanuddin Tamir <hasant@trabas.co.id>
TRABAS Technical Dept. PT Meitraco Bahana Sejahtera
IT Solution Provider http://www.trabas.co.id/
Surya Sumantri Blok B1 No. 35 Phone: +62-22-216660
Setrasari Mall Bandung 40146 Fax : +62-22-2007633
+================================================================+
SORRY: I ignore most of attachments but plain text type
+================================================================+
"Kalau ada kemauan, carilah jalan."
--Ikhsan, seorang teman
------------------------------
Date: 03 Jun 1999 13:00:45 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Perl script keeps terminating
Message-Id: <xkfvhd5az36.fsf@valdemar.col.hp.com>
kevin@nospam.co.uk (kevin) writes:
> On 3 Jun 1999 12:55:36 +0100, an opinion was expressed by Jonathan
> Stowe <gellyfish@gellyfish.com> stating:
> >How can we tell? 'auto-terminate' is not a very usefull piece
>
> <snip>
>
> Well it is. Because that is all that happens.
Yes, but it's still not very useful. If someone came up to you and said,
"My computer was running, now it's stopped. Why?", you probably couldn't
answer until you knew what error messages (if any) were displayed, what
the user was doing at the time, and so forth.
> If you do a ps you see it for a set amount of time
> and then 'bingo' it's gone.
Does it print out any error messages, return a meaningful exit code,
display a dialog in a remote console? In other words, how can we tell,
just from that, what's going on? Heck we don't even know what OS you're
running-- though I can bet it's a Unix variant, you might be running a PC
with MKS for all I know.
> I just wondered if anyone else has experienced
> a similar problem. The fact that i suspect it
> may be a server problem does not preclude it from being
> code related does it?
How can we tell, if you don't show us any code? Please try to keep your
code down to the minimum amount required to reproduce the problem
(usually 40 lines or less). Sometimes, just the effort of trying to
reduce the problem to its simplest case will help you find the error.
-=Eric
------------------------------
Date: Fri, 4 Jun 1999 00:52:47 +0700 (JAVT)
From: Hasanuddin Tamir <hasant@trabas.co.id>
To: comp.lang.perl.misc@list.deja.com
Subject: Re: Please help ?
Message-Id: <Pine.LNX.3.96.990604003726.348C-100000@borg.intern.trabas.co.id>
On Wed, 26 May 1999 tvn007@my-deja.com wrote:
tvn007] Date: Wed, 26 May 1999 17:43:35 GMT
tvn007] From: tvn007@my-deja.com
tvn007] To: comp.lang.perl.misc@list.deja.com
tvn007] Subject: Please help ?
tvn007] Reply-To: comp.lang.perl.misc@list.deja.com
tvn007] Organization: Deja.com - Share what you know. Learn what you don't.
tvn007]
tvn007] Hi,
tvn007]
tvn007] Would someone please help me on this ?
tvn007]
tvn007] I have the input file as follow: (just small sample )
tvn007]
tvn007]
tvn007] DATA X Y Z
tvn007] A B C;
tvn007]
tvn007] N100 xyz 10X
tvn007] 011;
tvn007] N10 xyz X01
tvn007] 000;
tvn007] N12 xyz 000
tvn007] 001;
tvn007]
tvn007] I would like the ouput as follow:
tvn007]
tvn007] DATA X Y Z A B C;
tvn007]
tvn007] N100 xyz 10X011;
tvn007] N10 xyz X01000;
tvn007] N12 xyz 000001;
tvn007]
tvn007] Here is my solution, but it does not work:
tvn007]
tvn007] while (<INFILE>) {
tvn007]
tvn007] print OUTFILE ($_\n");
tvn007] }
because you just print all lines literally.
how about this?
while (<INFILE>) {
# print the blank line and move to the next
print, next if /^$/
# remove trailing newline character
chomp;
# save the line if it doesn't end with `;'
# and move right away to the next line
$line = $_, next unless /;$/;
# remove preceeding spaces
s/^\s+//;
# finally print the two lines together
print "$line $_\n";
}
Note that this snip code merely based on your small example.
HTH,
-hasan-
+================================================================+
Hasanuddin Tamir <hasant@trabas.co.id>
TRABAS Technical Dept. PT Meitraco Bahana Sejahtera
IT Solution Provider http://www.trabas.co.id/
+================================================================+
SORRY: I ignore most of attachments but plain text type
+================================================================+
"VIM (Vi IMproved): the beauty and the strength of text editor."
--bOkiR, 1998/01/12 13:54:12
------------------------------
Date: 3 Jun 1999 19:33:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Problem with Regexp
Message-Id: <7j6l9t$gef$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <37568859@cs.colorado.edu>:
> :I want to match (for example) "Cake" or "Cookies" (insensitive) but both
> :have NOT to be leaded by (also for example) "Apple". So that I will
> :match "Plumcake","Plumcookies", only "Cake",only "Cookies" but not
> :"Applecake" or "Applecookies".
>
> m#(?<!apple)(cake|cookies)#i
>
> Which only gets cake or cookies in $1, not the preceding bits.
> If you want the whole thing in $1,
>
> m#\b((?!apple)\w*?(?:cake|cookies))#i
> man perlre.
Yes indeed:
perl -wle "'pinapplecookies' =~ \
m#\b((?!!apple)\w*?(?:cake|cookies))#i and die $&"
pinapplecookies at -e line 1.
Since the original question was not well posed, it may happen that
your answer is what is needed. Otherwise to write is nice one may need
m#\w*(?<!apple)(cake|cookies)#i
And it is not clear what you want to achive by your \w*? - the pattern
is anchored:
perl -wle "cakencookies' =~ \
m#\b((?!!apple)\w*?(?:cake|cookies))#i and print $&"
cake
Ilya
------------------------------
Date: 3 Jun 1999 19:21:50 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Speed question...
Message-Id: <7j6kke$g1o$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Uri Guttman
<uri@sysarch.com>],
who wrote in article <x7so89byjz.fsf@home.sysarch.com>:
> IZ> But the digit 100,000,000+ indeed looks suspicious. This is probably
> ^^^^^
> indeed it looks suspicious as it is not a digit. :-)
Why do you think so? It is just not decimal, but in the base 1e9.
> IZ> not a PC - even with HPFS386 you need at least two blocks for a
> IZ> non-empty file, which gives 1K per file, and means 100G. This rules
> IZ> out anything PCish. But AFAIK HPFS386 has no problem with directories
> IZ> with several millions of files. I did never check it, I'm running
> IZ> OS/2 client, not server, and it has only HPFS, which is much worse -
> IZ> its performance was reported to decrease starting from circa 200000
> IZ> files in a directory.
>
> IZ> Probably a mainframe...
>
> any you mention 1 filesystem that can handle that. maybe a couple of
> mainframe ones could too. that means most/not many others could
> regardless of whether they are unix.
I would guess that any OS which is not a legacy (as most kitchentop
Unixes) has a filesystem which is well designed. Remember that HPFS
was created in mid-80s (by MicroSoft!!! of all the guys), and HPFS386
was created beg-90s. I've heard that newer FS of Win* actually
outperform HPFS* - at least in some respects.
And I did not even mention AIX... Not that I know anything about
AIX, too ;-).
Ilya
------------------------------
Date: Thu, 3 Jun 1999 15:22:06 -0400
From: "Terry Mealy" <spike1965@worldnet.att.net>
Subject: Weird Warning from conditional
Message-Id: <7j6kh2$f1n$1@bgtnsc03.worldnet.att.net>
I am writing a rather large script to generate some prices, and I am having
problems with the following snippet which recurs in a for loop:
************************************
if ( $cities[$#flight] ne $cities[$#flight + 1] ) {
if($con_data{'ANCHOR'.$con_name} eq "Zero"){ #see if contract requires
anchor
if($city_data{$contract.$cities[$#flight]} ne "Zero" ||
$city_data{$contract.$cities[$#flight + 1]} ne "Zero"){ #check to see if
either city is not an anchor city
$rej_cons{$valid_cons[$contract]} .= '/"Mixed" contracts not allowed';
#Add contract to rejected contracts & append reason for rejection
}
}
}
************************************
I thought that very few of you would wish to see the entire script.
In any case, the problem occurs when I used the -w switch. The first line
generates a warning of "Use of uninitialized value at...".
All of the vars that appear in this snippet have most definitely been
initialized with my, (I am using sctrict) and in fact all of them were used
previously in other conditionals without warnings.
Substituting either value with a constant doesn't get rid of the warning.
Can anyone clue me into what might be happening?
I am using ActiveState perl on a Window$ 95 box. I am a perl novice. I just
graduated last month from perl neophyte.
------------------------------
Date: Thu, 3 Jun 1999 12:40:24 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Weird Warning from conditional
Message-Id: <Pine.GSO.4.02A.9906031238280.22017-100000@user2.teleport.com>
On Thu, 3 Jun 1999, Terry Mealy wrote:
> if ( $cities[$#flight] ne $cities[$#flight + 1] ) {
> In any case, the problem occurs when I used the -w switch. The first
> line generates a warning of "Use of uninitialized value at...".
>
> All of the vars that appear in this snippet have most definitely been
> initialized with my, (I am using sctrict) and in fact all of them were
> used previously in other conditionals without warnings.
I'd say that $cities[$#flight] or $cities[$#flight + 1] is pretty likely
to be undef. Try using the debugger, putting a breakpoint on that line,
and x-amining those values for yourself. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 3 Jun 1999 12:16:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: where did I go wrong?
Message-Id: <MPG.11c07476dc711339989b64@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <mVz53.2560$5a.5021@news20.bellglobal.com> on Thu, 03 Jun
1999 18:34:58 GMT, Marc Bissonnette <dragnet@internalysis.com> says...
> I'm trying to read in a file, pipe delimited, in order to work with the data
> loaded into hashes. When running the following, I get nothing. It's probably
> something really obvious, but I just can't seem to see it.
To answer your Subject question, mostly you went wrong by trying to use
symbolic references. Use a hash.
> A typical line from the (<DATAIN>) would be:
>
> Marc|Bissonnette|Consultant|Internalysis|
What, pray tell, is 'Internalysis' (besides your company name :-)???
> while (<DATAIN>) {
> push (@lines, $_);
> }
> close DATAIN;
> foreach (@lines) {
Why not just process the data a line at a time directly?
> @line = (split /\|/,$_);
> push (@names, $line[0]);
> $ident=$line[0];
> %$ident={
Above is the problem. See below for a complete program.
> fname => "$line[0]",
> lname => "$line[1]",
> title => "$line[2]",
> comp => "$line[3]",
Double-quotes around variables are superfluous and misleading.
> };
> }
>
> foreach (@names) {
> print $$ident{"fname"};
> }
And we will do this without using (gasp...) symbolic references.
#!/usr/local/bin/perl -w
use strict;
my (%data, @names);
while (<DATA>) {
my @line = split /\|/;
push @names, $line[0];
$data{$line[0]} = {
fname => $line[0],
lname => $line[1],
title => $line[2],
comp => $line[3],
};
}
foreach (@names) {
print $data{$_}{fname};
}
__END__
Marc|Bissonnette|Consultant|Internalysis|
Adolf|Hitler|Murderer|Mass|
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 3 Jun 1999 14:09:27 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: while (@myarr)
Message-Id: <x3yyai12m20.fsf@tigre.matrox.com>
jbell@263.net writes:
> when I say,
>
> my @myarr = (1,2,3,4);
> print $_ while @myarr;
>
> According to the Camel book, this should be okay.
> But it doesn't print 1234 as I expected. To top if off,
> it runs into a infinite loop and says " Uninitialized variable..."
> What seems to be the problem?
The problem is that you're confusing while() with foreach(). Where in
the Camel book does it show this code? I don't see it. You're
mistaken. You should read some more before posting.
The statement 'while (@myarr)' returns a true value as long as @myarr
has any elements. It does not set $_ to anything. 'foreach (@myarr)',
on the other hand, iterates through @myarr, each time making $_ refer
to the next element in the array.
Substitute 'foreach' instead of 'while' and all will be fine.
HTH,
Ala
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5879
**************************************