[11428] in Perl-Users-Digest
Perl-Users Digest, Issue: 5028 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 1 20:07:26 1999
Date: Mon, 1 Mar 99 17:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 1 Mar 1999 Volume: 8 Number: 5028
Today's topics:
Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos <andrewf@beausys.demon.co.uk>
Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos <andrewf@beausys.demon.co.uk>
Re: Adding directories to @INC (Greg Bacon)
ARGV filehandle and flock() <scarydakis@intracom.com.au>
Re: C->Perl->C Problem nadeem@gate.net
Database help <Eric@PAInternetServices.com>
Re: file comfirmation <jeromeo@atrieva.com>
Re: file comfirmation (Charles DeRykus)
Finding the word after a word kalikste@uiuc.edu
Re: gethostbyname bug? (Earl Hood)
Re: Help - regex to extract two fields in "uptime" (Charles DeRykus)
Re: Help Please: Script Optimization <trevor@bunny.demon.co.uk>
Re: Help Please: Script Optimization <ebohlman@netcom.com>
Re: Help!! n8rupert@my-dejanews.com
Re: Help: How to send email with attached multimedia fi (Pete)
Re: How does one 'tie' a db file to a hash' <emschwar@mail.uccs.edu>
Re: Is there a more efficient routine? <jaybyrd@macs.net>
Re: Is there a more efficient routine? <jeromeo@atrieva.com>
Re: localtime -> time <gellyfish@btinternet.com>
logically impaired <xcom2@popserver.panix.com>
Re: logically impaired <jeromeo@atrieva.com>
Re: newbie - writing html filter <ebohlman@netcom.com>
Newbie: String manipulation. <rob@best-buys.com>
Re: Newbie: String manipulation. (Alastair)
Re: Pentium III Chips Released with IDs - Intel won't b <kld_msmith@NOSPAMearthlink.net>
Re: Pentium III Chips Released with IDs - Intel won't b (Kenny Chaffin)
PERL COUNTER 4 my page <izsof@lisa.njszki.hu>
Re: PERL COUNTER 4 my page <ebohlman@netcom.com>
Re: Statistics for comp.lang.perl.misc (Greg Bacon)
Text file -> Array?? (Brent Singers)
Re: Text file -> Array?? <ahaas@neosoft.com>
Re: The MAP function - Win32 PERL programming <Savage.Ron.RS@bhp.com.au>
Re: Win95 print question <ebohlman@netcom.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 1 Mar 1999 16:32:24 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <YrwoeAAYEs22EwQk@beausys.demon.co.uk>
OK, so I admit that I havent been too much help to others in
this newsgroup (yet), but I have contributed a lot to other
(comms/networking) groups. Why ? Because I am a relative newbie
myself.
All I am saying is that, as a newbie, I find it unhelpful,
irritating and patronizing to be told time-after-time-after-time ....
read the FAQ! read the man pages! read the on-line articles! read
the books!
Personally, I dont yet know my way around the documentation,
but I do know that it doesnt answer everything. I'm gradually
reading more and more. As I have said before, the reply of RTFM
could, with some justification, be given to 95% of all questions.
I object to the implication that this newsgroup is primarily for
the experts to discuss "interesting" issues.
Finally, Uri ... calm down and stop the stupid remarks, illogical
extrapolations and abuse.
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: Mon, 1 Mar 1999 23:58:31 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <Okg8sUAnmy22EwyN@beausys.demon.co.uk>
In article <x7678lf9ay.fsf@home.sysarch.com>, Uri Guttman
<uri@home.sysarch.com> writes
>
>[a stealth copy was mailed without notice since this jerk is stealth
>emailing me. and he calls himself an experienced usenet user]
Sorry, URI is wrong again. I simply replied to his (abusive) e-mail
in the conventional manner. No "stealth e-mail".
As if being patronizing and abusive wasnt enough ... now he's a liar!
>
>>>>>> "AF" == Andrew Fry <andrewf@beausys.demon.co.uk> writes:
>
> AF> In message <x7iuclfd91.fsf@home.sysarch.com>, Uri Guttman
> AF> <uri@home.sysarch.com> writes
>
>
> AF> No, probably longer than you. I didnt say that it was a real-time
> AF> medium, so dont twist what I said or did not say.
> AF> And again, dont be so bloody patronising! You need to seek counselling,
> AF> methinks.
> AF> I have worked in communications for some 20 years, have a degree in
> AF> Computer Science and head a company. I dont need advice from assholes
> AF> like you.
>
>well, i beat you by a few years, little boy. and am patronizing you on
>purpose since you don't ever seem to help others but only complain about
>how we help. let's see you answer some actual questions. newbies helping
>newbies is like the blind leading the blind. we have corrected many
>newbies answers which were so wrong as to be unbelievable. untested,
>poor inefficient perl code. recommendations for matt's scripts and other
>misguided attempts at helping. there have been flame wars to start a
>newbie group or web page but of course, only the newbies would want it
>or go there so who would answer the questions? so i patronize you for
>expecting more than can be delivered and then complaining about
>it. either put up some answers yourself and earn the privileges or shut up
>about how we do it. we don't own the group but we do put in the work.
Uri, you have completely missed the point of what I was trying to say.
There are clearly many who do take the time to contribute and explain
(with pointers to the relevant documentation). All I am saying is that
there is no need to remind us newbies, ad nauseam, that we should read
the FAQs, man pages, online articles, books. RTFM is used far too often
in this newsgroup. And, as Uri's replies have shown, being sarcastic,
condescending, patronizing and abusive occasionally go along with the
reply.
And despite what some of you think, this newsgroup isnt just for the
elite to discuss "interesting" Perl issues.
>
>and which assholes do you get your advice from? they obviously have an
>apt student who understands how to answer faqs all day. i can tell you
>what to do and charge you more. that is a good deal.
>
>uri
>
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: 1 Mar 1999 22:35:46 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Adding directories to @INC
Message-Id: <7bf4o2$bv7$2@info.uah.edu>
In article <36db073f.0@newsread3.dircon.co.uk>,
"Paul Davies" <cobalt@dircon.co.uk> writes:
: I wish to permanently add more directories to @INC so more modules can be
: picked up and I don't have to specify search paths each time I start perl.
: Can someone please tell me how to do this
A few options:
1. Rebuild perl (@INC's default value is hard-coded.)
2. Update PERL5LIB (read the perlrun manpage about this)
3. Insert the appropriate list of C<use lib "...";> pragmata at
the top of your scripts.
Each has its associated pros and cons.
Greg
--
I don't think a powerful program makes my life better if I have to wear chains
to use it, if using it means I lose my freedom to share.
-- RMS
------------------------------
Date: Tue, 2 Mar 1999 09:24:44 +1100
From: "Stephan Carydakis" <scarydakis@intracom.com.au>
Subject: ARGV filehandle and flock()
Message-Id: <7bf471$elq$1@news.tmx.com.au>
Hello All,
I'm using the 'built-in' filehandle ARGV for a copy-pass style edit on a
flat text file:
my $path="..//data//$FORM{year}//$FORM{month}.dat";
@ARGV = ("$path");
$^I = ".bak";
while (<>) {
&lock();
@data = split /:/;
chomp @data;
if ($FORM{date} == $data[0]) {
$data[2]=$comp;
$data[3]=$events;
$data[4]=$comm;
$data[5]=$name;
}
$info = "$data[0]:$data[1]:$data[2]:$data[3]:$data[4]:$data[5]\n";
print $info;
&unlock();
}
The lock and unlock subs I'm using are straight out of the Camel:
sub lock { flock ARGV, $LOCK_EX; }
sub unlock { flock ARGV, $LOCK_UN; }
Since I am developing on winblows95 and the script/s will be on UNIX, I have
no way of telling if this is going to work. Is the filehandle I am using in
the lock and unlock subs correct? Also, I'm using ActiveState Perl and
calling flock() does not cause the script to throw an exception on my WIN95
box??? As far as I understand, flock() is not supported on WIN95.
Any helpful hints (or justified flaming) would be much appreciated.
thanks in advance
_______________________________
Stephan Carydakis
scarydakis@intracom.com.au
_______________________________
------------------------------
Date: Mon, 01 Mar 1999 22:14:50 GMT
From: nadeem@gate.net
Subject: Re: C->Perl->C Problem
Message-Id: <7bf3gh$9tq$1@nnrp1.dejanews.com>
you dumb-ass read the faqs
http://rlz.ne.mediaone.net/Perl.doc/pod/perlembed.html#Compiling_your_C_progr
am
especially the section called:
Using Perl modules, which themselves use C libraries, from your C program
---n
In article <36bb5b8c.0@news.syr.edu>,
rjirwin@top.cis.syr.edu (Robert J. Irwin) wrote:
> I'm trying to arrange things so that a C program with an embedded Perl
> interpreter can call a function in the Perl code it parses, and that
> Perl function can in turn call a C function in an XS module "use"d by
> that Perl code.
>
> My current software configuration:
>
> Perl 5.005_02, gcc 2.91.57, (Sparc) Solaris 2.5
> own C program which has embedded Perl interpreter
> own Perl code that is parsed and interpreted by the C program
> (the C program calls functions defined in this Perl code)
> own XS module to be "use"d by Perl code above
>
> The C->Perl set-up has worked for me previously, but that ended when
> I changed the Perl code to "use" the XS module I wrote -- i.e., when I
> tried a C->Perl->C route. Specifically, I get a msg to the effect
> that my perl wasn't built for dynamic loading, so my XS module can't
> be loaded.
>
> However, when I interpreted the changed Perl code with 'perl' at the
> command line, it successfully called functions in my XS module, so the
> Perl->C bit works, at least under those conditions. (Thus, my 'perl'
> executable *was* built to support dynamic loading. I would have
> guessed that the Perl library used to embed the Perl interpreter in my
> C program would also support dynamic loading -- aren't the perl
> executable and library built from the same objects?)
>
> So...I can get C->Perl and Perl->C to work separately, but I can't get
> C->Perl->C working. The material in perlxs, perlxstut, perlembed, and
> "Advanced Perl Programming" do not seem to address this issue directly.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Robert
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 01 Mar 1999 18:00:10 -0500
From: Eric Moyer <Eric@PAInternetServices.com>
Subject: Database help
Message-Id: <36DB1BF9.8C3E9DB1@PAInternetServices.com>
I've been doing quite a bit of perl coding over the past year or so, and
I've always generated my own text-file databases.
I don't know anything about the current Databases that are out there,
such as SQL. Could someone tell me what are the advantages to using
these Databases vs. a text-file database?
Also where might be a good place to find info on this sort of thing.
I'm very comfortable with perl, but I've just never been able to learn
the fundamentals of the existing database formats.
Please email any responses to me. I don't get to check the newsgroups
often enough.
Thanks in advance.
------------------------------
Date: Mon, 01 Mar 1999 13:57:56 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: cplee@bigfoot.com
Subject: Re: file comfirmation
Message-Id: <36DB0D64.CF589383@atrieva.com>
Cplee wrote:
>
> Howto use perl to confirm exist file
> please help
-e
For all the exciting details about -e and other file test operators, see
the -X file test operators section of the perlfunc manpage.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Mon, 1 Mar 1999 22:30:56 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: file comfirmation
Message-Id: <F7xt7K.Jsw@news.boeing.com>
In article <36DAC9FE.B5226BCD@bigfoot.com>, Cplee <cplee@bigfoot.com> wrote:
>Howto use perl to confirm exist file
perldoc perlfunc (then look for the file test operators, e.g., -e)
hth,
--
Charles DeRykus
------------------------------
Date: Mon, 01 Mar 1999 22:33:11 GMT
From: kalikste@uiuc.edu
Subject: Finding the word after a word
Message-Id: <7bf4j7$ap3$1@nnrp1.dejanews.com>
Quick question for a regular expression-
What is the most elegant way to extract the word after a specific word in a
string (words seperated by one space)? For example, if the string is "The
quick brown fox jumps over the lazy dog", given "brown", I want to return
"fox". In my situation, each word will only appear once in the string. I
appreciate all your input.
Thanks,
jeff
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 2 Mar 1999 00:21:15 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: gethostbyname bug?
Message-Id: <7bfatr$8qc@news.service.uci.edu>
[mailed & posted]
In article <7beu28$dj0@blather.cs.cornell.edu>,
Haye Chan <haye@cs.cornell.edu> wrote:
>Sorry. It's Perl 5.005_02 built for i86pc-solaris.
>
>And actually even the C socket library on my solaris also has the same
>problem. do you know any way to get all the IP addresses? Thanks.
Check /etc/nsswitch.conf to see how name resolution is specified.
nslookup uses /etc/resolv.conf to determine the DNS server to use for
doing lookups, however, the system itself may be configured to resolve
name lookups differently (eg: looking in local files or NIS) which may
result in only one address returned on a name lookup.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: Mon, 1 Mar 1999 23:53:28 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Help - regex to extract two fields in "uptime"
Message-Id: <F7xx14.sE@news.boeing.com>
In article <MPG.114358f44a7703d89896b5@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted and a courtesy copy mailed.]
>
>> ....
>> }
>
>How about this neater way (preserving the world's limited supply of
>semicolons):
>
> @uphash{ qw( time uptime users one_min_load five_min_load
> fifteen_min_load ) } = $uptime =~ /*your regex here*/x;
>
I'd still go verbose... but I draw the line at plundering the
world's supply of semicolons.
if ($uptime =~ m/^\s+(.+?)/g and $uphash{time} = $1 and
/\G\s+\w+\s+/g and $uphash{uptime} = $1 and
/\G(.+?),/g and $uphash{users} = $1 and
/\G\s+(\d+)/g and $uphash{one_min_load} = $1 and
/\G\s+users,.+: /g and $uphash{five_min_load} = $1 and
/\G([\d\.]+), /g and $uphash{fifteen_min_load} = $1 and
/\G[([\d\.]+)/g) {
...
}
--
Charles DeRykus
------------------------------
Date: Mon, 1 Mar 1999 23:22:47 -0000
From: "Trevor Squires" <trevor@bunny.demon.co.uk>
Subject: Re: Help Please: Script Optimization
Message-Id: <920330516.26573.0.nnrp-12.9e9838e3@news.demon.co.uk>
<SNIP>
>
>It takes the following line and gives me the IP address of a server.
>
>Pinging myserver.mynetwork.com [10.99.1.6] with 32 bytes of data:
<SNIP>
Are you really using ping just to obtain a host's ip address? If so, you
really ought to look at perl's gethostbyname funciton - i.e.
my $address = gethostbyname $host;
print "$address\n";
Read up on gethostbyname if you think the host has more than one interface.
BTW, you might want to watch out for different implementations of ping as
well. Off the top of my head simply calling "ping host" may ping forever
until interrupted, ping once and say "host is alive" or ping 4 times
depending on the OS.
Trevor
------------------------------
Date: Tue, 2 Mar 1999 00:40:37 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Help Please: Script Optimization
Message-Id: <ebohlmanF7xz7p.9IJ@netcom.com>
End User <kimntodd@dontspamus.execpc.com> wrote:
: here is a little scribble of code that I am sure can be prettied up:
: It takes the following line and gives me the IP address of a server.
: Pinging myserver.mynetwork.com [10.99.1.6] with 32 bytes of data:
: $host = "myserver";
: open(IP, "ping $host|");
Would be a good idea to check if the open was successful, although piped
opens will almost always succeed even if the command couldn't be run.
See the FAQs about this.
: while (defined($ip=<IP>)){
: @ipaddr = split(/\s/,$ip);
: $addr = $ipaddr[2];
The previous two lines could be written as one using an array slice,
eliminating an extra variable:
$addr = split(/\s/,$ip)[2];
: $_ = $addr;
: s/\[// && s/\]//;
: $addr = $_;
The previous three lines could be written as:
$addr =~ tr/[]//d;
You don't have to copy a string to $_ to perform matching, substitution or
transliteration on it: the =~ operator "binds" the operation to the
variable of your choice. Transliteration is much faster than substitution
when you're changing or deleting single characters. Note that the '[]'
here is just two literal characters, not a character-class specifier; tr//
doesn't use character classes.
: print "$addr\n";
------------------------------
Date: Tue, 02 Mar 1999 00:43:00 GMT
From: n8rupert@my-dejanews.com
Subject: Re: Help!!
Message-Id: <7bfc6h$his$1@nnrp1.dejanews.com>
In article <ORE4J6uY#GA.119@nih2naad.prod2.compuserve.com>,
"Clawed Le Mew" <clm@biteme.com> wrote:
> I am writing my first Perl script, which is a simple looping translation
> program, or so I thought until I actually wrote it.
> The problem I encountered is that I want to replace a number of expressions
> that literally begin with plus signs that are present in the data I am
> translating. Unfortunately for me, the plus signs are interpreted as regexp
> characters. How do I get around this?
>
> Here is the script so you can see what I am attempting to do.
> ------------
>
> #!/usr/local/bin/perl
>
> # This program is meant to read lines of text which contain many special
> character codes
> # as well as formatting codes which are nonstandard and which I want to
> universally replace
> # with a different set of codes. The way I have presented it here works. The
> problem
> # occurs when I try to use the values that begin with plus signs, shown
> below.
>
> @map =
> (
> "&", "&",
> "<", "<",
> ">", ">",
> 0,0);
>
> while (<>)
> {
> for( $a = 0; $map[$a]; $a+=2 )
> {
> s/$map[$a]/$map[$a+1]/g;
> }
> print "$_";
> }
> print "\n";
> #---------------------------------------------------------------------------
> ------------
> # end of program. What follows is the rest of the "@map" array I wanted to
> use,
> # commented out, of course.
> #
> # Note: These are actual "plus signs" that I want to search for and replace.
> # They are not intended to be regexp characters.
> #
> #"+100", "⁁",
> #"+200", "á",
> #"+201", "Á",
> #"+202", "à",
> #"+203", "À",
> #"+204", "â",
> #"+205", "Â",
> #"+206", "ä",
> #"+207", "Ä",
> #"+208", "å",
> #"+209", "Å",
> #"+210", "ā",
> #"+211", "Ā",
> #"+212", "&adot;",
> #"+213", "&Adot;",
> #"+214", "ă",
> #"+215", "Ă",
> #"+216", "ą",
> #"+217", "Ą",
> #"+218", "&acaron;",
> #"+219", "&Acaron;",
> #"+220", "ã",
> #"+221", "Ã",
> #"+222", "&acedil;",
> #"+223", "&Acedil;",
> #"+224", "&araisd;",
> #"+230", "ç",
> #"+231", "Ç",
> #"+232", "č",
> #"+233", "Č",
> #"+234", "ć",
> #"+235", "Ć",
> #"+236", "&cbreve;",
> #"+237", "&Cbreve;",
> #"+242", "&dcedil;",
> #"+243", "&Dcedil;",
> #"+244", "&ddot;",
> #"+245", "&Ddot;",
> #"+248", "é",
> #"+249", "É",
> #"+250", "è",
> #"+251", "È",
> #"+252", "ê",
> #"+253", "Ê",
> #"+254", "ë",
> #"+255", "Ë",
> #"+256", "ē",
> #"+257", "Ē",
> #"+258", "ě",
> #"+259", "Ě",
> #"+260", "ę",
> #"+261", "Ę",
> #"+262", "ė",
> #"+263", "Ė",
> #"+264", "&ebreve;",
> #"+265", "&Ebreve;",
> #"+274", "ğ",
> #"+275", "Ğ",
> #"+276", "&gcaron;",
> #"+277", "&Gcaron;",
> #"+282", "&hcedil;",
> #"+283", "&Hcedil;",
> #"+284", "&hdot;",
> #"+285", "&Hdot;",
> #"+290", "í",
> #"+291", "Í",
> #"+292", "ì",
> #"+293", "Ì",
> #"+294", "î",
> #"+295", "Î",
> #"+296", "ï",
> #"+297", "Ï",
> #"+298", "ī",
> #"+299", "Ī",
> #"+300", "&icaron;",
> #"+301", "&Icaron;",
> #"+302", "&ibreve;",
> #"+303", "&Ibreve;",
> #"+318", "ñ",
> #"+319", "Ñ",
> #"+320", "ń",
> #"+321", "Ń",
> #"+322", "ň",
> #"+323", "Ň",
> #"+324", "&ndot;",
> #"+325", "&Ndot;",
> #"+326", "ņ",
> #"+327", "Ņ",
> #"+330", "á",
> #"+331", "&udot;",
> #"+332", "ó",
> #"+333", "Ó",
> #"+334", "ò",
> #"+335", "Ò",
> #"+336", "ô",
> #"+337", "Ô",
> #"+338", "ö",
> #"+339", "Ö",
> #"+340", "ō",
> #"+341", "Ō",
> #"+342", "&obreve;",
> #"+343", "&Obreve;",
> #"+344", "õ",
> #"+345", "Õ",
> #"+346", "⊙",
> #"+347", "&Odot;",
> #"+348", "&ocedil;",
> #"+349", "&Ocedil;",
> #"+350", "ø",
> #"+351", "Ø",
> #"+360", "ř",
> #"+361", "Ř",
> #"+362", "&rdot;",
> #"+363", "&Rdot;",
> #"+364", "&rdotun;",
> #"+365", "&Rdotun;",
> #"+368", "š",
> #"+369", "Š",
> #"+370", "ş",
> #"+371", "Ş",
> #"+372", "ś",
> #"+373", "Ś",
> #"+374", "&sdotun;",
> #"+375", "&Sdotun;",
> #"+378", "ţ",
> #"+379", "Ţ",
> #"+380", "&tdotun;",
> #"+381", "&Tdotun;",
> #"+388", "ú",
> #"+389", "Ú",
> #"+390", "ù",
> #"+391", "Ù",
> #"+392", "û",
> #"+393", "Û",
> #"+394", "ü",
> #"+395", "Ü",
> #"+396", "ū",
> #"+397", "Ū",
> #"+398", "&udot;",
> #"+399", "&Udot;",
> #"+400", "ŭ",
> #"+401", "Ŭ",
> #"+402", "&ucaron;",
> #"+403", "&Ucaron;",
> #"+404", "ũ",
> #"+405", "Ũ",
> #"+406", "ů",
> #"+407", "Ů",
> #"+408", "&ucedil;",
> #"+409", "&Ucedil;",
> #"+414", "&wdot;",
> #"+415", "&Wdot;",
> #"+416", "&wuml;",
> #"+417", "&Wuml;",
> #"+426", "ý",
> #"+427", "Ý",
> #"+428", "ÿ",
> #"+429", "Ÿ",
> #"+430", "&ymacr;",
> #"+431", "&Ymacr;",
> #"+438", "ž",
> #"+439", "Ž",
> #"+440", "ź",
> #"+441", "Ź",
> #"+442", "ż",
> #"+443", "Ż",
> #"+444", "&zcedil;",
> #"+445", "&Zcedil;",
> #"+0", " ",
> #"+1", "‘",
> #"+2", "’",
> #"+5", "¶",
> #"+8", "[",
> #"+9", "]",
> #"+10", " ",
> #"+13", "—",
> #"+17", "§",
> #"+20", "°",
> #"+21", "<",
> #"+22", ">",
> #"+23", "¢",
> #"+24", "&smbull;",
> #"+25", "•",
> #"+30", "+",
> #"+31", "¿",
> #"+32", "=",
> #"+37", "“",
> #"+38", "”",
> #"+39", "&under;",
> #"+46", "|",
> #"+47", "\",
> #"+48", "{",
> #"+49", "}",
> #"+60", "˜",
> #"+73", "℞",
> #"+86", "Æ",
> #"+87", "æ",
> #"+96", "ß",
> #"+99", "☆",
> #"+cp", "<?lcaps?>",
> #"+nt", "<?notran?>",
> #"+sc", "<?scaps?>",
> #"+c", "<?clight6?>",
> #"+cm", "<?clight7?>",
> #"+cb", "<?cbold7?>",
> #"+cx", "<?cmed8?>",
> #"+p", "<?p?>",
> #"+p +10", "<?p?> ",
> #"+ql", "<?ql?>",
> #"+qr", "<?qr?>",
> #"+fl", "<?fl?>",
> #"+dc", "<?dcol?>",
> #"+d2", "<?dcolbk?>",
> #"+nl", "<?newln?>",
> #"+s", "<?sp?>",
> #"+bk", "<?bk?>",
> #"+bb ", "<?bb?>",
> #"+d", "‡",
> #"+l", "<?light6?>",
> #"+m", "<?light7?>",
> #"+x", "<?med8?>",
> #"+b", "<?b?>",
> #"+I", "<?it?>",
> #"+r", "<?rm?>",
> #"+ns", "<?newlnsm?>",
>
>
-------------
Try commenting out the + sign like so: #"\+whatever",
(put a backslash in front of your special characters)
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 1 Mar 1999 22:24:15 GMT
From: peter@markzware.com (Pete)
Subject: Re: Help: How to send email with attached multimedia files uploaded from a form?
Message-Id: <7bf42f$jqc$1@usenet40.supernews.com>
This only sends one file at a time though, any ideas how i can get it
to send mutliple files (selected via a form on the web) ?
Pete.
>I've written a script called automail_lite that can email out a
>binary attachment.
>
>It uses formmail (by matt wright) as a base code, and MIME::TOOLS
>to send the email.
>
>See
>http://www.datatrendsoftware.com/automail_lite.html
>
>HTH
>
>Edward Preble
>Datatrend Software
>http://www.datatrendsoftware.com
>mailto:info@datatrendsoftware.com
>
>Grab It! software for Excel 97
>Digitizes data from charts and graphs
>-----------------------------------------------------------------
>wwv1@inclab09.cs.depaul.edu wrote in message
><366C0388.F0030AC0@hotmail.com>...
>Hello,
> I'm a new user of perl. Is there anybody can tell me how to
>send
>email with attached files uploaded from a form? I'm using HP Unix
>platform and Apache server.
>
> Any help will be greatly appreciated. Thank you.
>
>Jane
>
>
------------------------------
Date: 01 Mar 1999 16:16:27 -0700
From: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: How does one 'tie' a db file to a hash'
Message-Id: <xkfaexwn6lw.fsf@valdemar.col.hp.com>
"J. Daniel Paxton" <paxtond@ix.netcom.com> writes:
> Anyway, I can't seem to tie the users.dbmx file to a hash. The process
> dies after the following line:
>
> my $timesleft=tie %timesleft, "SDBM_File", "users.dbmx";
> defined $timesleft or
> die "Unable to open or create timesleft: \n";
>
> Why? I've checked the permissions on the directory and the file. Am I
> missing something in the code?
try
die "Unable to open or create timesleft: $!" unless defined $timesleft;
It reads better, and the $! variable contains the error string that tells
you what went wront. In fact, I'd say you should almost always use $! in
a die statement, and I'd only be exaggerating a *little* bit.
-=Eric
------------------------------
Date: Mon, 01 Mar 1999 18:57:36 -0500
From: "Bill Chase" <jaybyrd@macs.net>
Subject: Re: Is there a more efficient routine?
Message-Id: <7bf9hk$jd7$1@ffx2nh5.news.uu.net>
Thanks Eric,
And yes it is a CGI. I should have mentioned it.
I'm still working on it and I know the file routine was ugly but I threw it
together to see if other routines would work as expected. The main focus was on
the 3 foreach loops, it seemed like there would be a better way of doing it. No?
Also because the file tempdb.txt name is to be unique such as using the time$$
to generate a unique name and after the transaction the file will be deleted. So
that was the reason I thought I would not need to lock it. It can only be
accessed by the user it was created for.
Thanks Again,
Bill
In article <ebohlmanF7x24x.61M@netcom.com> , Eric Bohlman <ebohlman@netcom.com>
wrote:
> Bill Chase <jaybyrd@macs.net> wrote:
> : All of the following works but is there a way of making it more efficient?
> : I also need to make sure that all items are unique and sorted after being
read
> : back out of tempdb.txt.
>
> : $pg = $formdata{'pg_id'};
>
> Am I correct in guessing that this is a CGI program?
>
> : #tempdb.txt is only for temporary holding
> : #til all selections have been made
> : #each tempdb.txt file must be unique for each customer
>
> : open(DB, ">>tempdb.txt");
> : print DB $pg;
>
> : open(DB, "tempdb.txt");
> : @tempdb = <DB>;
> : close (DB);
>
> Ugh. No attention to file locking (important if this is a CGI program)
> or error checking. Also not very efficient. Put
>
> use Fcntl ':flock';
>
> at the beginning of your code and replace the above lines with:
>
> open(DB,"+<tempdb.txt") or die "Can't open tempdb.txt: $!";
> flock(DB,LOCK_EX);
> @tempdb=<DB>;
> push @tempdb,$pg;
> seek(DB,0,2);
> print DB $pg;
> close(DB);
>
> : #this works but theres got to a more efficient way
>
> : foreach $page (@ tempdb) {
> : foreach $page (@page = split(/\|/, $page)){
> : foreach $item (@item = split(/\:/,$page)){
> : }
>
> Your repetition of variable names is confusing.
>
> That last foreach loop is superfluous; replace it with:
>
> @item=split(/:/,$page);
>
> : $title = $item[0];
> : $url = $item[1];
>
> : # remove commas and whitespce
> : $text = $title;
> : $text =~ s/\, / /g ;
> : $text =~ s/ / /g ;
> : $doc_title = $text;
>
> Replace everything after the comment with:
>
> ($doc_title=$title) =~ tr/, \t\r\n//d;
>
> : print "$title\n";
> : print "$url\n";
> : }
> : }
>
>
------------------------------
Date: Mon, 01 Mar 1999 16:20:41 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Is there a more efficient routine?
Message-Id: <36DB2ED9.3675D3E9@atrieva.com>
Eric Bohlman wrote:
> Ugh. No attention to file locking (important if this is a CGI program)
> or error checking. Also not very efficient. Put
>
> use Fcntl ':flock';
>
> at the beginning of your code and replace the above lines with:
>
> open(DB,"+<tempdb.txt") or die "Can't open tempdb.txt: $!";
> flock(DB,LOCK_EX);
> @tempdb=<DB>;
> push @tempdb,$pg;
> seek(DB,0,2);
> print DB $pg;
> close(DB);
Perl file locking is merely advisory. What happens if you are not able
to achieve the lock? It's a good idea to check the return status of
flock as well.
if(flock(DB,LOCK_EX)){
#Blah blah blah...
}else{
#Do what we do when we can't flock together...
}
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 1 Mar 1999 22:21:05 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: localtime -> time
Message-Id: <7bf3si$n8$1@gellyfish.btinternet.com>
On 28 Feb 1999 23:43:58 GMT M.J.T. Guy wrote:
> Jonathan Stowe <gellyfish@btinternet.com> wrote:
>>On Sun, 28 Feb 1999 15:46:46 GMT johan.levin@mbox300.swipnet.se wrote:
>>> There are two functions to convert from seconds-since-1970 to human-readable,
>>> but I haven't found an easy way to convert in the other direction.
>>>
>>> Is there a similar builtin for this (that I can't find) or do I have to do
>>> it manually?
>>
>>There is no builtin that will do that however there is Date::Parse that
>>does - it is part of the TimeDate package available from CPAN.
>
> Umm... that's somewhat misleading. Time::Local is part of every
> recent Perl distribution and probably does what Johan wants.
>
OK I take the Date::Parse back and give a big 'me too' on the Time::Local
thing ;-} I was assuming the original poster was wanting something into
which he could just bung some arbitrary date/time string and get a time_t
out. But if we are saying he can split the string up into its constituent
parts himself so be it ...
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 01 Mar 1999 17:43:24 -0500
From: Oliver Moffat <xcom2@popserver.panix.com>
Subject: logically impaired
Message-Id: <36DB1806.63E7522B@popserver.panix.com>
If you have a minute, would you mind taking a look at this? I had this
thing working last Friday, but then I smashed it this morning.
This is a chunk from a search engine that I can't get working. It's
perfectly valid perl, it just dosen't do what its supposed to.
What's supposed to happen is:
if the easy search didn't work, than we open each of our db files in @_.
Each line has our url, title, description, keywords, text and alt tags.
next LINE unless $line =~ m/\b$word/i; should break (continue) out of
the foreach word loop and go to the next line so that we only make it to
$hits++; if all the words are on the line.
But it doesn't work. For some reason it dosen't find any matches when I
know it should. Can you see what I'm doing wrong?
if ($hits == 0){ # if no hits, we look harder
foreach $FILE (@_){
open FILE or die "$FILE $!";
LINE: foreach $line (<FILE>){
foreach $word (@words){next LINE unless $line =~ m/\b$word/i;}
# if we make it here, the line has each word
$hits++;
($url, $title, $description) = split(/\t/,$line);
$found{$url}{'title'} = $title;
$found{$url}{'description'} = $description;
} # end foreach line
close FILE or die "$FILE $!";
} # end foreach file
} # end if hits is 0
------------------------------
Date: Mon, 01 Mar 1999 15:23:57 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: logically impaired
Message-Id: <36DB218D.C9EB539E@atrieva.com>
Oliver Moffat wrote:
use Debug::Psyschic;
my($oracle) = new Psychic;
$oracle->prognosticate<<EOBS;
> This is a chunk from a search engine that I can't get working. It's
> perfectly valid perl, it just dosen't do what its supposed to.
>
> if ($hits == 0){ # if no hits, we look harder
> foreach $FILE (@_){
> open FILE or die "$FILE $!";
> LINE: foreach $line (<FILE>){
> foreach $word (@words){next LINE unless $line =~ m/\b$word/i;}
> # if we make it here, the line has each word
> $hits++;
> ($url, $title, $description) = split(/\t/,$line);
> $found{$url}{'title'} = $title;
> $found{$url}{'description'} = $description;
> } # end foreach line
> close FILE or die "$FILE $!";
> } # end foreach file
> } # end if hits is 0
EOBS
$oracle->devine();
Oracle:: This is not valid perl.
Oracle:: User has not shown broken code, but a close approximation.
Oracle:: This didn't work yesterday.
Oracle:: Syntax error on line 17.
------------------------------
Date: Tue, 2 Mar 1999 00:26:36 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: newbie - writing html filter
Message-Id: <ebohlmanF7xyKC.8Lx@netcom.com>
Jamester76 <jdalldata@my-dejanews.com> wrote:
: I am trying to write a filter to convert an html file which consists of
: mulitple line records into a pipe-sign delimited flat file.
In general, you should use HTML::Parser to split up HTML into its
component parts, as naive regex-based solutions often fail on
tricky-but-legal HTML. In this case, it looks like your HTML is
guaranteed to follow a well-defined structure, so we go with a non-parser
solution.
: As I am very new to perl, i am having difficulty with this.
: Here is the code I am using thus far.
: #!/usr/local/bin/perl
-w would help here.
'use strict;' would also help.
: $i = 1;
: while (<>)
: {
: chomp;
: if (/<hr>/i) { # records begin with "<hr>" tag
: if (/<!--newrec-->/i) { # dummy header for record
: if (/<b>/i) { # "<b>" tage precedes name in file
Unfortunately, in your sample HTML the <hr>, <!...>, and the <b> are all
on different lines, but your code is applying the tests to the same line.
Your sample HTML doesn't indicate whether or not there's some predictable
text sequence at the end of each record; if there is, you'd be better off
setting $/ to that sequence and "slurping" a record at a time. If not,
you're going to have to come up with a tricky series of "I've seen this"
flags so that on any line, you know what preceded it.
: @names = split(' ', $_[0]);
Nothing in your code sets @_ to anything, so $_[0] is undefined. -w would
have given you a warning message about this. You probably wanted to
change your last regex to /<b>(.*)<\/b>/i, which would set $1 to the stuff
in between the tags. Then you'd replace '$_[0]' with '$1'.
: $num_names = @names;
You don't seem to be using $num_names anywhere else in the code.
: $fn[$i] = $names[0];
: $ln[$i] = $names[$#names];
: print "$i $fn[$i] $ln[$i] \n";
More Perlish:
push @fn, shift @names;
push @ln, shift @names;
print "$i $fn[-1] $ln[-1] \n";
: $i++;
: }
: }
: }
: }
: The html file looks like this
: <hr>
: <!--newrec-->
: <b>James Dennis</b>
: E-mail address: "<a href=mailto:jdennis@netset.com>"
: <TR><TD>name</td><td>name</td><td>dob</td><td>location</td><td>dod</td></tr>
: and many more lines of the table (up to 16 per persons name)
------------------------------
Date: Tue, 02 Mar 1999 00:01:37 GMT
From: "Rob Moore" <rob@best-buys.com>
Subject: Newbie: String manipulation.
Message-Id: <BTFC2.229$Yg1.207812@client.news.psi.net>
I've been wracking my brain on this for a couple of hours now, and since I'm
on deadline, I'm becoming less and less focused as I go. Here's the problem:
I have a flat text db file whith each line looking similar to:
8005551212,8,REALNAMEXXXXXX
The first field is a phonenumber and the first part of the third field
contains a proper name. The second field is a number indicating in
characters, the length of the name contained in the third field.
So if I say
($phone,$length,$longname) = split(/,/, $line);
I get $phone = 8005551212; $length = 8; $longname = REALNAMEXXXXXX
How do I get a string that only takes {$length} characters from {$name} and
discards the rest? I want to end up with $shortname = REALNAME
------------------------------
Date: Tue, 02 Mar 1999 00:33:01 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Newbie: String manipulation.
Message-Id: <slrn7dmch1.5h.alastair@calliope.demon.co.uk>
Rob Moore <rob@best-buys.com> wrote:
>
>I get $phone = 8005551212; $length = 8; $longname = REALNAMEXXXXXX
>
>How do I get a string that only takes {$length} characters from {$name} and
>discards the rest? I want to end up with $shortname = REALNAME
Have you considered using the 'substr' function?
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Mon, 1 Mar 1999 16:46:11 -0500
From: "Mike Smith" <kld_msmith@NOSPAMearthlink.net>
Subject: Re: Pentium III Chips Released with IDs - Intel won't budge
Message-Id: <7bf1q2$cui$1@birch.prod.itd.earthlink.net>
Big Brother Inside wrote in message <36e3fbf9.6298553@news.earthlink.net>...
>
> Pentium III chip with the individual serial number that can
>track your web surfing and buying habits can now have the ID number
ANSI C does not contain any functions or structures regarding processor
serial numbers. Your post is off-topic for news://comp.lang.c but it might
be more appropriate on
comp.intel.quit.yer.whinin.if.you.dont.like.it.dont.buy.the.damn.thing.
'kay?
--
Mike Smith. No, the other one.
------------------------------
Date: Mon, 1 Mar 1999 16:20:27 -0700
From: kenny@kacweb.com (Kenny Chaffin)
Subject: Re: Pentium III Chips Released with IDs - Intel won't budge
Message-Id: <MPG.1144cea6d34f8a3698a8bb@news.dimensional.com>
In article <7bf1q2$cui$1@birch.prod.itd.earthlink.net>,
kld_msmith@NOSPAMearthlink.net says...
> Big Brother Inside wrote in message <36e3fbf9.6298553@news.earthlink.net>...
> >
> > Pentium III chip with the individual serial number that can
> >track your web surfing and buying habits can now have the ID number
>
>
> ANSI C does not contain any functions or structures regarding processor
> serial numbers. Your post is off-topic for news://comp.lang.c but it might
> be more appropriate on
> comp.intel.quit.yer.whinin.if.you.dont.like.it.dont.buy.the.damn.thing.
> 'kay?
> --
> Mike Smith. No, the other one.
>
>
>
>
>
Well you may not want to admit it, but it will affect you or your
customers/clients/company....
And as far as not buying it, that would be great if intel/microsoft
didn't have a monopoly on the pc market....
Best Wishes,
KAC
--
KAC Website Design
Custom Programming, Web Design, and Graphics
kenny@kacweb.com - http://www.kacweb.com
------------------------------
Date: Mon, 1 Mar 1999 22:37:59 +0100
From: "Dixie Flatline" <izsof@lisa.njszki.hu>
Subject: PERL COUNTER 4 my page
Message-Id: <7bf7el$n21$1@bolka.matav.net>
Hi!
I've made the following perl script, which is intented to be counter for my
webpage:
---------START szar.pl
#!/usr/bin/perl
print "Content-type: text/html\n\n";
open (ID, "<visitors");
$szam = <ID>;
$szam = $szam+1;
print "$szam";
print "<H1>foss $szam</H1>";
close(ID);
open (ID, ">visitors");
print ID $szam;
close(ID);
---------END szar.pl
It runs perfectly when I log into the server via telnet, but when I try to
invoke it from my browser It don't want to display anything.
I use it from my page with this line:
<!--#exec cgi="/cgi-bin/szar.pl" -->
What can be wrong? (Maybe the HTML parsing is OFF???)
Thanks in Advance & Best Regards,
deadline@freemail.c3.hu -->Primary
izsof@lisa.njszki.hu --> Secondary
http://lisa.njszki.hu/~izsof --> Dixie Flatline's HARDWiRED
Flatline
------------------------------
Date: Tue, 2 Mar 1999 00:49:08 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: PERL COUNTER 4 my page
Message-Id: <ebohlmanF7xzLw.9xu@netcom.com>
Dixie Flatline <izsof@lisa.njszki.hu> wrote:
: Hi!
: I've made the following perl script, which is intented to be counter for my
: webpage:
: ---------START szar.pl
: #!/usr/bin/perl
You forgot the -w and the use strict.
: print "Content-type: text/html\n\n";
You're invoking this as a server-parsed 'exec' in the middle of your
page, at which point the headers have already been sent out; the above
line will appear as literal text in your page.
: open (ID, "<visitors");
: $szam = <ID>;
: $szam = $szam+1;
: print "$szam";
: print "<H1>foss $szam</H1>";
: close(ID);
: open (ID, ">visitors");
: print ID $szam;
: close(ID);
There are quite a few things wrong with this code. You don't check your
opens for success, which makes debugging hard, and you don't lock your
file, which means that if two or more people access the script at the same
time, your count will advance by only one because each invocation will
read the old value, increment it by one, and then write it out again.
Read the sections in perlfaq5 starting with "How do I lock a file?"
: ---------END szar.pl
: It runs perfectly when I log into the server via telnet, but when I try to
: invoke it from my browser It don't want to display anything.
: I use it from my page with this line:
: <!--#exec cgi="/cgi-bin/szar.pl" -->
I'm not sure this is the right syntax; you may be missing some
whitespace. Check the documentation for your server.
------------------------------
Date: 1 Mar 1999 22:30:56 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <7bf4f0$bv7$1@info.uah.edu>
In article <39d82sj4e1.fsf@ibnets.com>,
Uri Guttman <uri@ibnets.com> writes:
: but my reply-to reflects where i am at so i can't use that to merge
: my counts. maybe a way of registering my addresses or saying for these
: addresses use the real name. this is very important as we must have
: accurate posting stats or perl will perish for this world!
Please go back to my first response and reread the sentence beginning
with "You (or anyone...".
Greg
--
When a man is more right than his neighbor, that constitutes a majority of
one.
-- Thoreau
------------------------------
Date: Mon, 01 Mar 1999 22:58:20 GMT
From: brent.s@ihug.co.nz (Brent Singers)
Subject: Text file -> Array??
Message-Id: <36db1a00.580109@news.ihug.co.nz>
If anyone can help me with this one I would be very grateful!
I have a text file that looks like this:
"Field1","Field2","Field3","Field4"
"a1","b1","c1","d1"
"a2","b2","c2","d2"
"a3","b3","c3","d3"
etc....
It was exported from a Microsoft Access database. I need to do the
following:
1) create a series of array's named "Field1", "Field2" etc
2) populate those array's with the columns in the file (i.e. the
values in the 'a' column going in @Field1.
Does anybody have any ideas that would make this easy for me? I have
looked on the web, in a few books and haven't found the solution.
Again, any help would be much appreciated :)
Brent
------------------------------
Date: Mon, 01 Mar 1999 18:29:11 -0600
From: Art Haas <ahaas@neosoft.com>
Subject: Re: Text file -> Array??
Message-Id: <36DB30D7.A127629C@neosoft.com>
Brent Singers wrote:
>
> If anyone can help me with this one I would be very grateful!
>
> I have a text file that looks like this:
>
> "Field1","Field2","Field3","Field4"
> "a1","b1","c1","d1"
> "a2","b2","c2","d2"
> "a3","b3","c3","d3"
>
> etc....
>
> It was exported from a Microsoft Access database. I need to do the
> following:
>
> 1) create a series of array's named "Field1", "Field2" etc
> 2) populate those array's with the columns in the file (i.e. the
> values in the 'a' column going in @Field1.
>
> Does anybody have any ideas that would make this easy for me? I have
> looked on the web, in a few books and haven't found the solution.
>
> Again, any help would be much appreciated :)
>
> Brent
Hi.
Here's my stab at it:
#!/usr/bin/perl
#
# quickie script
#
%fields = ();
@field_names = ();
@data = ();
#
# the file './text_file' holds your data
#
open(FILE,"./text_file") || die "Can't open './text_file'! $!\n";
chomp($line = <FILE>);
@field_names = split(",",$line);
while(<FILE>) {
chomp;
@data = split(",",$_);
foreach $name (@field_names) {
push(@{$fields{$name}},shift(@data));
}
}
foreach $key (keys %fields) {
print "Field name ==> '$key'\n";
foreach $field (@{$fields{$key}}) {
print "\t$field\n";
}
}
My './text_file' ...
"Field1","Field2","Field3","Field4"
"a1","b1","c1","d1"
"a2","b2","c2","d2"
"a3","b3","c3","d3"
"a4","b4","c4","d4"
Running this produces ...
Field name ==> '"Field1"'
"a1"
"a2"
"a3"
"a4"
Field name ==> '"Field2"'
"b1"
"b2"
"b3"
"b4"
Field name ==> '"Field3"'
"c1"
"c2"
"c3"
"c4"
Field name ==> '"Field4"'
"d1"
"d2"
"d3"
"d4"
Edit as you see fit.
Art Haas
------------------------------
Date: Tue, 2 Mar 1999 10:24:13 +1100
From: "Ron Savage" <Savage.Ron.RS@bhp.com.au>
Subject: Re: The MAP function - Win32 PERL programming
Message-Id: <7bf75l$1iv5@atbhp.corpmel.bhp.com.au>
map { $icount++; print "$icount) $_\n"} @list;
This looks confusing, but the author is simply printing
1) x
2) y
3) z
--
Ron Savage
Office (preferred): Savage.Ron.RS@bhp.com.au
Home: rpsavage@ozemail.com.au
http://www.ozemail.com.au/~rpsavage
mirak63@my-dejanews.com wrote in message
<7betv1$4jh$1@nnrp1.dejanews.com>...
>On page 24 of Dave Roth's book Win32 Perl Programming there is a sample
script
>that refers to the "map" function. I have inserted that below.
>
>use Win32::NetAdmin;
>if (Win32::NetAdmin::GetServers('','',SV_TYPE_NT, \@list))
> {
> print "The machines in this doamin are: \n";
> map { $icount++; print "$icount) $_\n"} @list;
> }
>else {
> print Win32::FormatMessage(Win32::NetAdmin::GetError());
> }
>
>My problem is I don't understand the syntax. Mainly; "icount)
>Doesn't a close paren follow an open paren and likewise with the quote?
>Please forgive the newbie question.
>
>Thanks,
>Karim Wall
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
------------------------------
Date: Tue, 2 Mar 1999 00:32:14 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Win95 print question
Message-Id: <ebohlmanF7xytq.91C@netcom.com>
Peter Meyer <pwmeyer@mitre.org> wrote:
: I'm trying to print an array element ($foo[$bar-1]) but I can't get it to print out. I tried
: running the answer from ORA and their version wouldn't work either! All my other print()s work
: fine. I put print's before AND after the problem one.
: Code follows:
: use Sys::Hostname;
: # Exercise 3.2 from the book
: # write a program which reads a number followed
: # by a list of strings on separate lines.
: # print the string which corresponds with
: # the number entered.
: print "Enter the number: ";
: chomp ($theNumber = <STDIN>);
: print "Enter the strings (at least $theNumber): \n";
: @theList = <STDIN>;
: $foo = $theList[$theNumber-1];
: print ("You asked for $foo"); # This is the print which won't
: $host = hostname;
: print "Tonight's host is $host"; # This prints ok
You're running up against a bug in the Win95 console output routines.
Under some circumstances, if you input a bunch of lines and terminate
them with a Ctrl+Z, the first line of output printed afterward will get
erased and overwritten on the screen, so it looks like the print didn't
execute even though it did (if you redirect the output to a file, the
line will be there).
The solution is to print a blank line immediately after you've finished
getting input from STDIN.
------------------------------
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 5028
**************************************