[13593] in Perl-Users-Digest
Perl-Users Digest, Issue: 1003 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 6 16:10:43 1999
Date: Wed, 6 Oct 1999 13:10:33 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939240632-v9-i1003@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 6 Oct 1999 Volume: 9 Number: 1003
Today's topics:
gif files <baga@gmx.de>
Re: gif files <elaine@chaos.wustl.edu>
Re: gif files <debot@xs4all.nl>
HELP!!!!!!!!! IF statement keeps executing krun@my-deja.com
Re: HELP!!!!!!!!! IF statement keeps executing (Larry Rosler)
Re: HELP!!!!!!!!! IF statement keeps executing <laurensmith@sprynet.com>
Re: how to change a '\' to '/' ? <hartleh1@westat.com>
Re: inserting new character <rhomberg@ife.ee.ethz.ch>
Re: Memory leak in assignment <aqumsieh@matrox.com>
Need example of oraperl. <al_kohaulicNOalSPAM@yahoo.com.invalid>
Re: Need help with input verifier (Abigail)
need intro for perl to MySQL <NOSPAMschan_ca@geocities.com>
Re: need intro for perl to MySQL <elaine@chaos.wustl.edu>
Re: odd or even numbers? (Craig Berry)
Re: odd or even numbers? (Craig Berry)
Re: perl Ad (Randal L. Schwartz)
Re: perl Ad <AgitatorsBand@yahoo.com>
Re: perl Ad <kperrier@blkbox.com>
Re: Perl Libraries <dove@synopsys.com>
Re: Perl WildCards ??? HELP <AgitatorsBand@yahoo.com>
Re: Perl WildCards ??? HELP (Larry Rosler)
Re: Perl WildCards ??? HELP (Larry Rosler)
Re: Perl WildCards ??? HELP (Larry Rosler)
Re: Perl WildCards ??? HELP <uri@sysarch.com>
Re: Perl WildCards ??? HELP <ehowarth@axtive.com>
Re: Perl WildCards ??? HELP <uri@sysarch.com>
Perplexed with newlines while sending mail <me@toao.net>
re: previous link <ICEMOUNTAIN@prodigy.net>
Re: print (join ':',@y)," missing\n" (Was: bug or featu (Abigail)
Re: pulling out a paricular DB Hash entry (Bill Moseley)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 06 Oct 1999 18:33:54 +0200
From: Hans <baga@gmx.de>
Subject: gif files
Message-Id: <37FB79F2.7664DEEF@gmx.de>
Hello,
I search a script that converts a gif-picture into a certain size (that
you can choose). I want to use specthat for making
Is that possible?
Thanks a lot,
Hans
------------------------------
Date: Wed, 06 Oct 1999 12:59:19 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: gif files
Message-Id: <37FB7F1A.3D6CAE14@chaos.wustl.edu>
Hans wrote:
> I search a script that converts a gif-picture into a certain size (that
> Is that possible?
It's possible :) http://search.cpan.org/search?module=Image::Magick
Not a script, but a module that makes it easy to write a script to do
what you need.
> Thanks a lot,
Bitte.
e.
------------------------------
Date: Wed, 06 Oct 1999 21:49:03 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: gif files
Message-Id: <37FBA7AF.7E50378C@xs4all.nl>
I think you could best use FLY. http://www.unimelb.edu.au/fly/fly.html It's
a little program which build gif files. You can draw, but you can also copy
image and resize them.
Hans wrote:
> Hello,
>
> I search a script that converts a gif-picture into a certain size (that
> you can choose). I want to use specthat for making
> Is that possible?
> Thanks a lot,
> Hans
--
Penpal International
http://ppi.searchy.net
ppi@searchy.net or debot@xs4all.nl
------------------------------
Date: Wed, 06 Oct 1999 16:37:58 GMT
From: krun@my-deja.com
Subject: HELP!!!!!!!!! IF statement keeps executing
Message-Id: <7tftt4$1dl$1@nnrp1.deja.com>
I wanted the program to search a log file for "\"
to get the parent of a dir. A sample of the log
file is like this:
.\alpha\prod@@
.\alpha\prod\bin@@
.\alpha\prod\debug@@
.\alpha\prod\debug\exe@@
.\alpha\prod\debug\exe\DriverPCIReceiver@@
The program code is:
open (voblist, "//momentum/vob_update/test.log")
||
die ("Unable to open file");
@filedir=<voblist>;
chop(@filedir);
chop(@filedir);
chop(@filedir);
$filedirlength=@filedir;
$count=0;
while($count<=$filedirlength)
{
@path[0]=@filedir[$count];
$pathlength= length @path[0];
$pos=$pathlength;
$slash=0;
while($slash<2)
{
$temp=substr(@path[0], ($pos-
1),1);
if ($temp == "\\")
{
$slash++;
}
$pos--;
}
$diff=$pathlength-$pos;
@parent_child[$count] = (substr(@path[0],-
$diff,$diff));
$count++;
}
print(@parent_child);
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 6 Oct 1999 10:50:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP!!!!!!!!! IF statement keeps executing
Message-Id: <MPG.12652bc0d7eb26698a049@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7tftt4$1dl$1@nnrp1.deja.com> on Wed, 06 Oct 1999 16:37:58
GMT, krun@my-deja.com <krun@my-deja.com> says...
> I wanted the program to search a log file for "\"
> to get the parent of a dir. A sample of the log
> file is like this:
<SNIP> reproduced below
> The program code is:
>
> open (voblist, "//momentum/vob_update/test.log")
It is conventional to use upper-case identifiers for filehandles. The
'-w' flag would have warned you of this.
> ||
> die ("Unable to open file");
It is useful to include the reason why the open() failed: $!.
> @filedir=<voblist>;
It is seldom necessary to read an entire file into an array before
processing it. This is one of those cases where it is not necessary.
> chop(@filedir);
> chop(@filedir);
> chop(@filedir);
The above operations aren't necessary if you solve the problem with a
regex, as shown below.
> $filedirlength=@filedir;
>
> $count=0;
> while($count<=$filedirlength)
This accesses one element past the end of the array.
while ($count < @filedir) {
> {
> @path[0]=@filedir[$count];
The '-w' flag would tell you how to write that line correctly. The '@'
prefix refers to an array or (in this case) an array slice. What you
want are scalars, for which the prefix is '$'.
> $pathlength= length @path[0];
> $pos=$pathlength;
> $slash=0;
> while($slash<2)
> {
> $temp=substr(@path[0], ($pos-
> 1),1);
> if ($temp == "\\")
You are comparing two strings using a numerical comparison operator
'=='. Each string when evaluated as a number is 0. So this test always
succeeds. The '-w' flag would have told you about this also!
> {
> $slash++;
> }
>
> $pos--;
>
> }
> $diff=$pathlength-$pos;
> @parent_child[$count] = (substr(@path[0],-
> $diff,$diff));
It is just too hard to read this code to figure out what result you
want, and you didn't say so explicitly. I will assume you mean that the
'parent' is the name between the last two backslashes. If that isn't
what you want, adjust the regex accordingly.
> $count++;
> }
The solution to your problem is essentially a 'one-liner'. You need to
learn about regexes from some Perl tutorial. With a regex, your
contorted character manipulations above reduce to triviality.
#!/usr/local/bin/perl -w
use strict;
my @parent_child;
while (<DATA>) {
/\\([^\\]+)\\[^\\]+$/ and push @parent_child, $1;
}
print join "\n", @parent_child, "";
__END__
> .\alpha\prod@@
> .\alpha\prod\bin@@
> .\alpha\prod\debug@@
> .\alpha\prod\debug\exe@@
> .\alpha\prod\debug\exe\DriverPCIReceiver@@
Output:
alpha
prod
prod
debug
exe
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 6 Oct 1999 11:16:57 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: HELP!!!!!!!!! IF statement keeps executing
Message-Id: <7tg3nl$fru$1@brokaw.wa.com>
krun@my-deja.com wrote in message <7tftt4$1dl$1@nnrp1.deja.com>...
Let's try to clean this up a bit.
No -w (or shebang line, for that matter).
No use strict.
> open (voblist, "//momentum/vob_update/test.log") || die "test.log:
$!";
# I hate Outlook, it's trying to htmlify that path for me...
> @filedir=<voblist>; # Have you thought of reading the lines in one by
one?
> chop(@filedir);
> chop(@filedir);
> chop(@filedir); # Funny enough, I have code just like this laying
around. :-)
> $filedirlength=@filedir; # Unnecessary because you can use a foreach
loop on @filedir
>
>$count=0;
>while($count<=$filedirlength)
>{
# Indentation can be helpful for keeping an eye on program flow
> @path[0]=@filedir[$count]; # This is a syntax error
> $pathlength= length @path[0];
> $pos=$pathlength;
> $slash=0;
> while($slash<2)
> {
> $temp=substr(@path[0], ($pos-
>1),1);
> if ($temp == "\\")
> {
> $slash++;
> }
> $pos--;
> }
# Holy Cow, you wrote your own Regular Expression engine! Perl has one
built in.
> $diff=$pathlength-$pos;
> @parent_child[$count] = (substr(@path[0],-
>$diff,$diff));
# You aren't capturing the parent of the file, only the child's name.
> $count++;
>}
>
>print(@parent_child);
Here's a cleaner (and working) solution:
#!perl -w
use strict;
open (VOBLIST, "test.log") or die "test.log: $!";
my @parent_child;
while (<VOBLIST>) {
my $path = substr($_,0,-3);
if ($path =~ /(.*)\\(.*?)$/) {
my $entry = "$2's parent is: $1\n";
push (@parent_child, $entry);
} else {
print "$path: is not a valid path\n";
}
}
print @parent_child;
HTH,
Lauren
------------------------------
Date: Wed, 06 Oct 1999 14:03:09 -0400
From: HHH <hartleh1@westat.com>
Subject: Re: how to change a '\' to '/' ?
Message-Id: <37FB8EDD.B109E9ED@westat.com>
Tobias Rudolph wrote:
> <NukeEmUp@ThePentagon.com> wrote:
>
> Ok, I guess my question was'nt very clear. Let's try it again :).
>
> I read a file (ascii) with paths in it.
> For example the file could look like this:
>
> home\1234567890\1234567890-0
> ... # several other lines with paths; all paths have '\' as delimiter
>
> When I read the file (@lines = <FILE>), I want to change all the
> '\'-delimiters to '/'.
How 'bout:
$path =~ s/\\/\//g;
HHH
------------------------------
Date: Wed, 06 Oct 1999 18:33:09 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: inserting new character
Message-Id: <37FB79C5.59D5D71C@ife.ee.ethz.ch>
Noira Hadi wrote:
> I format them to have:
>
> A,B,B,D
> A,B,D
>
> The question is how do I format them so that I can have:
>
> A,B,B,D
> A,B,C,D
To insert characters into a string, look at
perldoc -f substr
To insert an element into an array, look at
perldoc -f splice
- Alex
------------------------------
Date: Wed, 6 Oct 1999 12:20:54 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Memory leak in assignment
Message-Id: <x3yaepw795l.fsf@tigre.matrox.com>
rob1234567@my-deja.com writes:
> ## start of perl script
> %a=();
>
> if (1) {
> $a["19990920"]++;
You have something wrong here. You are creating an *ARRAY* @a and
assigning to it. You are not assigning to the hash %a. For that, you
have to use curly braces:
$a{19990920}++;
HTH,
--Ala
------------------------------
Date: Wed, 06 Oct 1999 09:34:00 -0700
From: dnr74 <al_kohaulicNOalSPAM@yahoo.com.invalid>
Subject: Need example of oraperl.
Message-Id: <004aa0e3.cc8533cd@usw-ex0102-011.remarq.com>
Hi,
Could someone send me or post an example of oraperl. Specifically
using oraperl to enter information in a table. I can get the query
functions of oraperl to work but can't get the insertion of data into a
table to work. I would greatly appreciate any help.
Thanks,
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 6 Oct 1999 13:59:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Need help with input verifier
Message-Id: <slrn7vn7gl.23p.abigail@alexandra.delanet.com>
Jana Cole or John Sayre (quikscor@ix.netcom.com) wrote on MMCCXXVI
September MCMXCIII in <URL:news:37f9f74c.4187507@nntp.ix.netcom.com>:
,,
,, I just saw a mistake in the code ("emt" should be "frm").
,, Here's the new version:
And then you copy the entire 150 lines of the original message
as well? You're a luser.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 06 Oct 1999 09:24:43 -0700
From: stephen <NOSPAMschan_ca@geocities.com>
Subject: need intro for perl to MySQL
Message-Id: <37FB77CA.1E0CE4F5@geocities.com>
Hello:
Can someone send me a small example Perl program
to query a MySQL database? Warnings, pitfalls and
pointers much appreciated.
Thanks in advance
Stephen
------------------------------
Date: Wed, 06 Oct 1999 12:52:58 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: need intro for perl to MySQL
Message-Id: <37FB7D9D.F2B6C28C@chaos.wustl.edu>
stephen wrote:
> Can someone send me a small example Perl program
> to query a MySQL database? Warnings, pitfalls and
> pointers much appreciated.
There is a very well done manual that comes with the mySQL source as
well as being on-line at http://www.mysql.com/Manual_chapter/manual_Clients.html#Perl
enjoy.
e.
------------------------------
Date: Wed, 06 Oct 1999 19:10:02 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: odd or even numbers?
Message-Id: <rvn7ka3q8m962@corp.supernews.com>
Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote:
[snip]
: Which is reasonable since text is 0 in perl (unless the text looks like a
: number of course). And 0 is usually considered to be even.
Zero is even as a standard case, no special consideration required, since
0 % 2 == 0.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "There it is; take it." - William Mulholland
------------------------------
Date: Wed, 06 Oct 1999 19:12:21 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: odd or even numbers?
Message-Id: <rvn7ollr8m961@corp.supernews.com>
homeless (homelessinseattle@yahoo.com) wrote:
: >Does anybody know if there is an easy way to check whether a scalar value
: >contains a odd or even integer?
:
: I'm not near as smart as all you perl pros, but it seems to me like
: "contains" an odd or even number
: is a bit different than "is" an odd or even number.
:
: $number =~ m/[13579]/ and $number_contains_odd_integer="TRUE";
:
: Am I close?
Well, if you're into spec-bending, yeah. :) Were I to ask for your check,
I'd tend to phrase it as 'contains an even numeral', and also change
'_integer' to '_numeral' in the variable name.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "There it is; take it." - William Mulholland
------------------------------
Date: 06 Oct 1999 09:24:36 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: perl Ad
Message-Id: <m1ogecihiz.fsf@halfdome.holdit.com>
>>>>> "One" == One Bored Guru <" <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>> writes:
One> Attention Perl-5/Linux Programmers.
One> The Sync3 Developement Team is looking for Perl-5/Linux programmers
One> to help on an open source project writing a new type of bbs designed
One> for Linux and The Internet.
And to do so, they're willing to CONTINUE TO INVOKE THE IRE of this
community by posting this FRIGGIN LAME AD every few days, and not
responding to any of my requests to halt or explain further.
One> If you think you have the skill and are
One> interested, please send email to devteam[at]sync3.com indicating your
One> interest and providing us with the relevant details pertaining to
One> your skill level and previous experience.
And therefore if you work for them, you are also in a shamefully
unethical position associating with people that don't play by the
rules, abusing the free resource called Usenet.
One> Thank you for your time
One> and interest.
Thank you for having NO FRIGGIN CLUE.
One> Steve Byers,
One> Project Administrator,
One> The Sync3 Project.
One> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
One> + The Talamasca Internet Newsgroup Gateway +
One> telnet://talamasca-bbs.com
OK, first, just to ensure that the spammers get these addresses:
devteam@sync3.com
root@sync3.com
usenet@sync3.com
from whois sync3.com
Byers, Steven M (SMB106) admin501@GTE.NET
I think these IDJITS need an award for the STUPIDEST ABUSE of a usenet
newsgroup so far.
Bleh. OK. Just my opinion.
And I swear. The next time I see this posting, I will set up a
cancelbot to delete it on sight. It's malformed (the return address
is mangled), and it's apparently being posted by a postbot that is not
human. If an actual human was posting it, it would say something
slightly different each time.
You have every right to say your piece on Usenet. You said your piece.
Needless repetition is NOT a protected right. You have been warned.
You will be cancelled the next time I see this posting.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 06 Oct 1999 16:56:22 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: perl Ad
Message-Id: <WaLK3.197$Q11.39343@news.shore.net>
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
: OK, first, just to ensure that the spammers get these addresses:
: devteam@sync3.com
: root@sync3.com
: usenet@sync3.com
:
: from whois sync3.com
: Byers, Steven M (SMB106) admin501@GTE.NET
Actually, isn't it usually better to put those in the headers to make sure
the spammers can find them with a minimum of effort? :)
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 06 Oct 1999 13:55:01 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: perl Ad
Message-Id: <C363B128505C4354.012E5F39ADA169C6.437895FD3AA19656@lp.airnews.net>
Scratchie <AgitatorsBand@yahoo.com> writes:
>
> Actually, isn't it usually better to put those in the headers to make sure
> the spammers can find them with a minimum of effort? :)
No. They just scan news spools for the form <string>@<string>
According to a news admin that I know, they get a lot of email sent to addresses
that can only come from message ids.
Kent
--
Expect to be publicly mocked as long as you call yourselves "perl experts".
- Abigail in slrn7qbcr6.r33.abigail@alexandra.delanet.com
------------------------------
Date: Wed, 06 Oct 1999 10:08:32 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Perl Libraries
Message-Id: <37FB8210.33E5D76D@synopsys.com>
Hi Robert,
Robert Korteweg wrote:
> How do i put a location of a librarie in my perl scripts
Try the use lib pragma:
use lib ("/sites/www/scripts.bos.nl/cgi-bin/lib");
Hope this helps,
-=dav
------------------------------
Date: Wed, 06 Oct 1999 16:59:22 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Perl WildCards ??? HELP
Message-Id: <KdLK3.198$Q11.39343@news.shore.net>
ingr <aecraigNOaeSPAM@ingr.com.invalid> wrote:
: What I have is an ASCII file that I need to sort through roughly 340
: 000 rows, of which randomly spaced throughout are rows of data that I
: am trying to pull out and place into a new ASCII file. Each row of
: data in my input ASCII file has about 100 characters in it (both
: numeric and alphabetic). The data that I need to pull out is entire
: lines of data that contain the value of '1200', somewhere within the
: row of data.
%perl -ne 'print if /1200/' oldfile > newfile
Ought to do it. You don't need to use a wild card because this regular
expression (/1200/) will match a line that contains these four characters
together anywhere on the line.
Hope this helps,
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Wed, 6 Oct 1999 09:53:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl WildCards ??? HELP
Message-Id: <MPG.12651e757b6e46c698a045@nntp.hpl.hp.com>
In article <Pine.BSF.4.05.9910061130170.5882-100000@monet.bestweb.net>
on Wed, 06 Oct 1999 15:35:39 GMT, Mike Salter <msalter@bestweb.net>
says...
> Assuming the '1200' is a word, try below,
> otherwise use pattern /.*1200.*/
Which matches exactly the same as /1200/, except slower (because it has
to eat the whole string then scan backwards to find the *last* '1200').
But it looks more impressive.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 6 Oct 1999 10:02:07 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl WildCards ??? HELP
Message-Id: <MPG.12652068bd6d80e598a046@nntp.hpl.hp.com>
In article <37FB6B43.7FE682B5@anlon.com> on Wed, 06 Oct 1999 10:31:15 -
0500, Kangas <kangas@anlon.com> says...
[rearranged to put question before answer]
> ingr wrote:
...
> > What I have is an ASCII file that I need to sort through roughly 340
> > 000 rows, of which randomly spaced throughout are rows of data that I
> > am trying to pull out and place into a new ASCII file. Each row of
> > data in my input ASCII file has about 100 characters in it (both
> > numeric and alphabetic). ...
> here is a snippet of code that I am writing from the hip but should give
> you the idea of what I think that you are looking for.
>
> open(FILE, "your.filename");
And if the open() fails???
> @original = <FILE>;
> close(FILE);
>
> open(COPY, ">1200.matches.file");
And if the open() fails???
> foreach(@original) {
> if($_ =~ /1200/g) {
if (/1200/) {
...
> hope this is what your looking for :o)
I doubt it. 340_000 rows * 100 characters per row = 34_000_000 bytes,
plus the very significant Perl overhead.
Only a small fraction of problems really require reading a whole file
into an array, rather than processing it one line at a time. This is
not one of those problems.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 6 Oct 1999 10:05:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl WildCards ??? HELP
Message-Id: <MPG.1265212e6b0b83e198a047@nntp.hpl.hp.com>
In article <x7n1twqzzt.fsf@home.sysarch.com> on 06 Oct 1999 11:18:30 -
0400, Uri Guttman <uri@sysarch.com> says...
...
> and if the problem is just getting the lines with 1200 out, use grep.
I assume you mean the Unix/POSIX 'grep' command, not the Perl 'grep'
function. The latter works on a list, which requires reading the entire
file at once, not one line at a time.
/1200/ and print OUT while <IN>;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 06 Oct 1999 15:07:33 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl WildCards ??? HELP
Message-Id: <x7emf8qpe2.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> In article <x7n1twqzzt.fsf@home.sysarch.com> on 06 Oct 1999 11:18:30 -
LR> 0400, Uri Guttman <uri@sysarch.com> says...
LR> ...
>> and if the problem is just getting the lines with 1200 out, use grep.
LR> I assume you mean the Unix/POSIX 'grep' command, not the Perl 'grep'
LR> function. The latter works on a list, which requires reading the entire
LR> file at once, not one line at a time.
duhh!! i ain't that dumb larry. i should have mentioned grep utility to
be clear to her. you, on the other hand should know what i meant.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Wed, 06 Oct 1999 16:27:17 GMT
From: Evan Howarth <ehowarth@axtive.com>
Subject: Re: Perl WildCards ??? HELP
Message-Id: <7tft8i$tm$1@nnrp1.deja.com>
> What I have is an ASCII file that I need to sort through roughly 340
> 000 rows, of which randomly spaced throughout are rows of data that I
> am trying to pull out and place into a new ASCII file. Each row of
> data in my input ASCII file has about 100 characters in it (both
> numeric and alphabetic). The data that I need to pull out is entire
> lines of data that contain the value of '1200', somewhere within the
> row of data.
Read about regular expressions in perlop or perlre. These
manpages have been converted to web pages at:
http://www.perl.com/CPAN/doc/manual/html/pod/perlop.html
http://www.perl.com/CPAN/doc/manual/html/pod/perlre.html
One solution to your problem:
while( <INPUT_FILE> ) {
print <OUTPUT_FILE> $_ if /1200/;
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 06 Oct 1999 15:16:09 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl WildCards ??? HELP
Message-Id: <x7aepwqozq.fsf@home.sysarch.com>
>>>>> "EH" == Evan Howarth <ehowarth@axtive.com> writes:
EH> One solution to your problem:
EH> while( <INPUT_FILE> ) {
EH> print <OUTPUT_FILE> $_ if /1200/;
EH> }
why are you posting illegal code? do you have any reason for doing this?
this thread has been answered multiple times (mostly correctly) so you
should also have looked for other followups. it is nice to try to help
but it is better to help correctly.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Wed, 06 Oct 1999 19:39:37 GMT
From: Graham W. Boyes <me@toao.net>
Subject: Perplexed with newlines while sending mail
Message-Id: <7tg8hn$9ue$1@nnrp1.deja.com>
I'm a little perplexed here...
I'm trying to open a file and send it to an e-mail address. The file
is HTML based, so I want to ignore the newlines already in the HTML
file, and replace all the <BR>'s with newlines. Ex,
Hello<BR>how
are you
should result as
Hello
How are you
I have tried different methods replacing <BR> with \n, (tr, s, etc...)
but when I receive the e-mail with different clients, the result is not
consistent. For example, with Internet Mail, I received *three*
newlines at the <BR> and with Pegasus I received the message in one
long line.
Thanks for advice in advance,
Graham W. Boyes
--
"The One and Only"
me AT toao DOT net ~ http://www.toao.net
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 6 Oct 1999 15:20:02 -0400
From: <ICEMOUNTAIN@prodigy.net>
Subject: re: previous link
Message-Id: <7tg7h7$4gpu$1@newssvr04-int.news.prodigy.com>
Thanks for the help. I dont have an error checking thing. Do I put -w on
after #usr/bin/local/perl/. I just started perl and never had a book to
learn, I just learn as I go. My website is only for 1982 - 1992 Camaros, so
I dont have to worry about the year 2000 thing. On my computer my post
didn't have any other replies besides yours, was there some on your
computer?
Thanks, Chris
-----------------------------------------------------------------
http://www.3gc.net/ , 3rd Generation Camaros
-----------------------------------------------------------------
------------------------------
Date: 6 Oct 1999 13:25:29 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: print (join ':',@y)," missing\n" (Was: bug or feature?)
Message-Id: <slrn7vn5gh.23p.abigail@alexandra.delanet.com>
John Lin (johnlin@chttl.com.tw) wrote on MMCCXXVII September MCMXCIII in
<URL:news:7te97b$ob8@netnews.hinet.net>:
%%
%% I've got the warning and the surprising result, which I don't understand.
%%
%% @y=(23,24,25);
%% print (join ":", @y)," missing\n";
%%
%% Warnings:
%% print (...) interpreted as function
%% Useless use of a constant in void context
%%
%% Does it warn that in
%% print join ...
%% 'join' is interpreted as function, not a filehandle?
Eh. The warning "print (...) interpreted as function", would be kind of
silly if Perl actually means that join is interpreted as a function.
Specially since join *is* a function.
And it would be a mistake to assume that join returns filehandles.
%% Then why is the string " missing\n" in void context?
Because it is interpreting "print (....)" as a function. And since
that is a function, " missing\n" isn't an argument of print, and
hence in void context.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 6 Oct 1999 09:19:32 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: pulling out a paricular DB Hash entry
Message-Id: <MPG.126516719dc87bc09897dd@206.184.139.132>
mandersjones@my-deja.com (mandersjones@my-deja.com) seems to say...
> Is it possible to pull out the nth value from a DB hash file i.e. so
> that you can say 'for entries 10 to 20 get the value and keys'.
> Otherwise I'll have to set up separate index file won't I?
How do you define 'nth value'? Is there some type of implied order to
the hash?
perldoc -f sort
perldoc -f grep
come to mind.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1003
**************************************