[8282] in Perl-Users-Digest
Perl-Users Digest, Issue: 1899 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 14 15:07:31 1998
Date: Sat, 14 Feb 98 12:00:27 -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 Sat, 14 Feb 1998 Volume: 8 Number: 1899
Today's topics:
Re: A Pubilc Apology. <ldanna@hotmail.com>
Re: Banner help? <webmaster@fccj.cc.fl.us>
Re: Binary Search Trees <tchrist@mox.perl.com>
Re: clpm.moderated: Ideas about automoderation <ldanna@hotmail.com>
clueless in Columbus <gwallace@ee.net>
CONTRACT WORK: web interface to RADIUS server <dlinsalata@equinox.net>
Re: CRs in scripts - ARGH! <dfetter@shell4.ba.best.com>
Re: FAQless Forays (was: Code Example Needed) (Rodger Donaldson)
Re: formating a text file (hard returns)? <baughj@rpi.edu>
Re: Good Perl editors <baughj@rpi.edu>
how to emulate http server <nitecom@concentric.net>
How to: "ENTER = submit form" ? (Aldert Hoogland)
Re: New perl programmer requesting comments (Jonathan Feinberg)
Re: Newbie Regexp question! (Hunter Johnson)
Re: Novice: 6 - Can't figure out how to read input from (Gabor)
Re: on reading FAQs and gurus answering questions <merlyn@stonehenge.com>
Re: Perl 5 for Win32 Q: How can I determine how a scrip <madebeer@igc.apc.org>
Re: Quickie: regexp for valid e-mail addresses <danboo@negia.net>
Re: Sort help please! (Jonathan Feinberg)
Re: Substituing Ctrl characters <khuber@yuck.net>
Re: Substituing Ctrl characters (Jonathan Feinberg)
Re: Substitution in perl for newbie (Hunter Johnson)
Re: Substitution in perl for newbie (Jerry)
Re: The Young Man and the Beach <ldanna@hotmail.com>
Re: The Young Man and the Beach <ldanna@hotmail.com>
Tom Christiansen <jfo@btinternet.com>
Re: Tom Christiansen <jfo@btinternet.com>
VB5: Win95 sound volume control (Thijs Kinkhorst)
Re: Where to start. <nitecom@concentric.net>
Re: Why does this crash Perl 5.004_02 under Win NT?... (Troy Denkinger)
Re: Why is Tom Christiansen so rude? <ldanna@hotmail.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 14 Feb 1998 13:18:17 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: A Pubilc Apology.
Message-Id: <34E5DFE9.9E58AE4B@hotmail.com>
Sitaram Chamarty wrote:
>
> On Fri, 13 Feb 1998 02:24:47 -0500, Larry D'Anna <ldanna@hotmail.com> wrote:
> >I wish all of the morons saying "Tom is a rude elitist ass hole"
> >would see the light like that. :-)
>
> I'm not sure if I was included in your list of morons, but I did
> use the word "elitist" to Tom, so I'd like to clarify things a
> bit.
>
I was referring to the people who pollute clpm with diatribes
about how rude Tom is while they post questions like
"how do I get perl to work with II$ ?"
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Sat, 14 Feb 1998 19:42:57 GMT
From: Bill Jones <webmaster@fccj.cc.fl.us>
Subject: Re: Banner help?
Message-Id: <34E5F2B2.D99CC3A4@fccj.cc.fl.us>
See
http://www.cgicity.com
Mike Hallock wrote:
> Could someone please help me out here?
>
> I need three scripts: redirect.pl, banner.pl, and addbanner.pl, as well
> as a flat database. I then want addbanner to add stuff to the
> flatdatabase, like the URL | IMAGEBASEURL | IMAGENAME, and then I want
> redirect and banner to read from it, and work together to print out the
> coorisponding data.
>
> That way, someone in my banner can just use:
>
> <a href=http://name.com/cgi/redirect.pl><img
> src=http://name.com/cgi/banner.pl></a>
>
> And it would display the banner and link.
>
> For example, look at http://www.planetquake.com, they have a benner
> script that they won't let me see, but it's set up like that.
>
> --
> +----------------------------------------------------------------------+
> | /\___ |\___ ___/||\___ |\ |\ |\___ |\ /_\ |\___ |
> | | _ / | __/ \ __||_ __\| || | | __/ | \|\ /| | __/ |
> | ||_/ | __| \_ \ | | | || |__ | __| | \ |\|_ | __| |
> | || |___/ /__/ |_| |_| \___\|___/ |_|\_| \ / |___/ |
> | mikeh@medina.net * Mike Hallock * http://defcon4.medina.net/ |
> +-====================================================================-+
------------------------------
Date: 14 Feb 1998 17:01:10 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Binary Search Trees
Message-Id: <6c4ikm$iaj$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
abigail@fnx.com writes:
:That's a nice table, but what did you benchmark? What's the problem
:you're solving?
Insert 100,000 random dictionary words into a dynamic set, then
produce those strings in sorted order.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Help save the world!" --Larry Wall in README
------------------------------
Date: Sat, 14 Feb 1998 13:39:15 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: clpm.moderated: Ideas about automoderation
Message-Id: <34E5E4D3.554CD092@hotmail.com>
[ sniped great idea ]
I think this is a wonderful idea. IMHO, Much of
the degeneration usenet has suffered is because the
rules are no longer made obvious to newbies before
they post.
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Sat, 14 Feb 1998 12:59:47 -0500
From: Greg Wallace <gwallace@ee.net>
Subject: clueless in Columbus
Message-Id: <34E5DB93.A7F5F7DA@ee.net>
I need to run a perl program which operates on globbed files in a
certain directory. I'd like to launch the program from SQL Server 6.5
on Windows NT 4. My perl program works well when it is launched in the
same directory as the files it will read. But SQL Server's xp_cmdshell
(which shells me out to perl) wishes to run the perl script on from
/winnt/system32. And for some reason my glob doesn't work with a path
in front of it. Nor can I chdir. Nor can I Win32::SetCwd (which may
not be the right idea anyway).
The problem is obvious. I don't have rights, right? But I'm an
administrator logged into the database as 'sa' and I've given the SQL
Executive administrator rights for the moment. Clearly I'm missing the
point somewhere. Advice will be greatly appreciated.
------------------------------
Date: Sat, 14 Feb 1998 11:51:20 -0500
From: "Drew Linsalata" <dlinsalata@equinox.net>
Subject: CONTRACT WORK: web interface to RADIUS server
Message-Id: <6c4i43$n1p$1@news01.equinox.net>
2/14/98
Greetings Perl Gurus,
EQUINOX Internet Services Corp. is seeking the assistance of an experienced
Perl programmer to create a web based interface to our primary and secondary
RADIUS servers.
The project requires:
Experience with Perl CGI design
Experience in a UNIX (FreeBSD) environment
Experience with the Apache httpd
The ability to work quickly and accurately
Sensitivity to server and network security issues
Maturity, responsibility and accountability
We would like to implement the following in our web based RADIUS interface:
Authenticate web visitors via username and password before allowing RADIUS
access
Allow lookup users in RADIUS user file
Allow addition of new entries in RADIUS user file
Allow modification of existing entries in RADIUS user file
Search of RADIUS error logs
Backup of RADIUS user file
Shutdown and restart of RADIUS daemon
Logging of all accesses and user file actions
Once this is completed, we will look toward building a web interface to
RADIUS accounting logs.
Please direct all estimates on pricing (lump sum or hourly) and time
required to complete via email to dlinsalata@equinox.net. Please include a
brief resume or outline of related experience with references if at all
possible.
Thanks!
Drew Linsalata
President/CEO
EQUINOX Internet Services Corp
home of
MacConnect - Connecting the Mac OS to the World
http://www.macconnect.com
------------------------------
Date: 14 Feb 1998 17:05:42 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: CRs in scripts - ARGH!
Message-Id: <6c4it6$ol2$1@nntp1.ba.best.com>
David Hardy <dhardy@beagle.colorado.edu> wrote:
> Does anyone know of an easy way to make perl accept CR/LFs as well as
> just LFs in scripts? It's a pain in the neck to have to convert when I
> write scripts on my PC.
perl -pi.bak -e 's#\cM##g' *
--
David Fetter 888 O'Farrell Street Apt E1205
shackle@ren.glaci.com San Francisco, CA 94109-7089 USA
http://www.best.com/~dfetter +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)
The software required `Windows 95 or better', so I installed Linux.
------------------------------
Date: Fri, 13 Feb 1998 20:10:20 +0000
From: rodgerd@orwell.rm.gen.nz (Rodger Donaldson)
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <slrn6ebugf.bfa.rodgerd@orwell.rm.gen.nz>
On 12 Feb 1998 05:47:03 GMT, Eric D. Friedman <friedman@uci.edu> wrote:
>The baffling thing about it is that it's totally counter-intuitive.
>When I need an answer, posting to Usenet is my last resort because
>it's always faster to look in a book or in Dejanews. Always.
Hear, hear! I'm a total amateur with perl, but I've managed to solve every
problem I've run into thus far with the docs, and the Llama and Camel books.
One particular problem I had, and solved, was posted by someone to this very
newsgroup. I helped them out. In the resulting exchange of emails, with
the other person seemingly unable to make quite simple efforts to diagnose
problems, took far, far longer than it had for me to solve the same problem
with perl.com, perldoc, and Camel.
--
Rodger Donaldson rodgerd@ihug.co.nz
The Pinguin Patrol
------------------------------
Date: Sat, 14 Feb 1998 13:45:26 -0500
From: "Justin Baugh" <baughj@rpi.edu>
Subject: Re: formating a text file (hard returns)?
Message-Id: <6c4onv$ngq@newsfeeds.rpi.edu>
Clay Irving wrote in message <6c47o4$9u9@panix.com>...
>In <34e5358e.524144494f47414741@radiogaga.harz.de> martin@RADIOGAGA.HARZ.DE
(Martin Vorlaender) writes:
>
>>John Davidson Highfill (davidson@unity.ncsu.edu) wrote:
>>: I have been trying to make up a perl script
>>: (I am VERY new to perl, and programing in general)(If it makes a diff
>>: i am using linux slackware) that would atuomatically format a text file
>>: so that is is say 70 char long bout would not cut off words (rather hard
>>: return and put them on the next line).
>
>>Have a look into CPAN, the Comprehensive Perl Archive Network, at
>>http://www.perl.com/CPAN/ . In the modules section, you'll find
>>Text::Wrap.
>
>Even better -- Text::Wrap is included in recent Perl distributions.
Is Text::Wrap the same as breaking according to newlines, or does wrap just
take one biiiig line and break it into smaller lines?
-jdb
************************************************************************
Justin D. Baugh, DorkSci major........uhh wait, that's CompSci
"CS majors do it better.......wait...hell, we don't do it at all!"
Jolt Cola - The blood plasma of a New Generation(TM). Try it today!
Rensselaer Polytechnic Institute (baughj@rpi.edu)
------------------------------
Date: Sat, 14 Feb 1998 13:57:04 -0500
From: "Justin Baugh" <baughj@rpi.edu>
Subject: Re: Good Perl editors
Message-Id: <6c4pdo$nsi@newsfeeds.rpi.edu>
Zachary Kessin wrote in message ...
>
>
>>Someone asked about editors for perl.
>
>I swear by emacs. A lot of people swear at it. You can get an NT
>version which is Decent. If you use emacs with perl use the cperl.el
>that comes with the perl source. Not the perl mode that comes with
>emacs. I at least think the one that comes with perl is better. I
>assume some people like the other one.
>
>As for editors, its is a very personal choice. Try a few.
>
>--Zachary Kessin
Maybe I'm a dork, but I use pico. Emacs is an editor that tries to do way
more than that. Personally I think any editor with macro commands
reminiscent of WordPerfect 3 is not worth using, let alone installing (ever
check out how big the distribution is? Emacs weighs in at about 13mb last
time I checked. </endgratuitousemacsflame>
Granted, for C, emacs is invaluable for m-x compile and m-x line and the
error window, but since I don't like the command line interface to emacs, I
don't use it when I'm telnetted in to my Linux box, and therefore use Pico.
(I prefer the Xwin version of emacs. Keep your snide comments about having
to be in a GUI to yourself. :)
Cheers,
Justin Baugh
************************************************************************
Justin D. Baugh, DorkSci major........uhh wait, that's CompSci
"CS majors do it better.......wait...hell, we don't do it at all!"
Jolt Cola - The blood plasma of a New Generation(TM). Try it today!
Rensselaer Polytechnic Institute, Troy, NY (baughj@rpi.edu)
------------------------------
Date: Sat, 14 Feb 1998 13:35:28 -0600
From: "dale" <nitecom@concentric.net>
Subject: how to emulate http server
Message-Id: <6c4s9j$rja@examiner.concentric.net>
Is there software one can download
to run under DOS or win95 to
emulate a http server? I want to test
perl cgi scripts on my PC without having
to ftp to a remote server.
------------------------------
Date: Sat, 14 Feb 1998 18:41:15 +0100
From: itsme@dds.nl (Aldert Hoogland)
Subject: How to: "ENTER = submit form" ?
Message-Id: <199802141841152191326@spy01-04.dial.xs4all.nl>
I have built a web-store using the Selenal Sol web_store cgi-script.
I changed some things in the script to make it more useful for my
situation. There is one problem that I don't know how to solve:
Many people hit the ENTER key to submit a form, for example many search
engines work that way. The search-engine that is embedded in the
web-store script however resets the form when you hit the ENTER-key.
This can be very confusing for people, who might think the search-engine
did not find any results.
How do I need to change the script or the HTML for the form so that it
will also submit the form after hitting the ENTER-key. If possible, I
would prefer to make this changement only for forms that have only one
input text-field. When there are more fields I want only the
SUBMIT-button to submit the form.
Aldert
--
ICQ number: 4389791 Find more about ICQ on http://www.mirabilis.com
Anti-SPAM: Replace "whoisit" with "itsme" to email me!
------------------------------
Date: Sat, 14 Feb 1998 12:17:03 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: New perl programmer requesting comments
Message-Id: <MPG.f4f9b9dda98f4e89896c7@news.concentric.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to the
cited author.]
baughj@rpi.edu said...
> #!/usr/bin/perl
Justin - throw the -w switch on that shebang line, and perl itself will let
you know about a couple of obvious thinkos that I saw on a casual perusal.
Always use -w. You might also want to
use diagnostics;
for a more thorough explanation of the things -w flags as not good. In the
meantime, I'm sure other folks will be more specific in response. Good luck!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 14 Feb 1998 17:11:33 GMT
From: jhunterj@lexis-nexis.com (Hunter Johnson)
Subject: Re: Newbie Regexp question!
Message-Id: <6c4j85$127@mailgate.lexis-nexis.com>
In article <19980213163400.LAA03435@ladder03.news.aol.com>,
KMartino1 <kmartino1@aol.com> wrote:
> I need to replace null chars (ASCII=0) in a string with spaces and
> can't quite figure out how to do it. I believe I need to use a
> regexp, but I can't figure out the syntax to find a null and do the
> replace. I've been able to use regexp to do all sorts of cool
> replaces....but nulls elude me. If someone could help out a
> newbie... I'd appreciate it.
Does
s/\0/ /g;
not work?
Hunter
--
J. Hunter Johnson | "A little consistent wholesome modeling and
jhunterj@lexis-nexis.com | costly servanthood are worth millions of
(937) 865-6800 x5385 | true words harshly spoken."
Lexis-Nexis, Dayton, OH | -- Ron Sider
------------------------------
Date: 14 Feb 1998 17:04:43 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Novice: 6 - Can't figure out how to read input from the keyboard.
Message-Id: <slrn6ebjhb.h6h.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Marek Jedlinski <eristic@lodz.pdi.net> wrote :
#
# It's the (latest) activestate port of perl running on win95. My
# program is building an array of queries to be run later, and I
# want an option to iterate over the array, asking the user if the
# particular query should be accepted or skipped, allowing only
# Y(es), N(o), A(ll) and Q(uit) responses. Here's a minimalist
# version of what I'm trying to do:
#
# -------------------------------------------------------
# @tmp = ('one', 'two', 'three', 'four', 'five' );
#
# foreach $item (@tmp) {
# print "\nWanna do \"$item\"?\n";
# $reply = &get_reply();
# #...and do other stuff depending on $reply
# }
#
# sub get_reply {
# my $keypress = " ";
# while ( $keypress !~ /[YNAQ]/i ) {
# # allow only Yes, No, All or Quit responses
# print "(Y/N/A/Q) ";
# $keypress = getc;
# chomp $keypress; # doesn't help, see below
# }
# return $keypress;
# }
# -------------------------------------------------------
#
# And here's this gem of wizardry in action:
#
# -------------------------------------------------------
# Wanna do "one"?
# (Y/N/A/Q) y
#
# Wanna do "two"?
# (Y/N/A/Q) (Y/N/A/Q) y
#
# Wanna do "three"?
# (Y/N/A/Q) (Y/N/A/Q) n
#
# Wanna do "four"?
# (Y/N/A/Q) (Y/N/A/Q) # ...Grr, Ctrl-C! :(
# -------------------------------------------------------
#
#
# You see the problem. The first time &get_reply() is called, it
# works fine. After that, it always executes the "while" block
# twice, once magically feeding the getc() with a keypress
# I-don't-know-where-from, and only reading the keyboard properly
# on the second lap.
And think about it just for a moment. getc gets the next character
from the buffer, but you still have to hit at least one more character
to get that character. Namely <enter>. Now that's still a character
and it's still in the buffer so getc goes and happily returns it.
Use the angle operator instead
sub get_key
{
my $input = <STDIN>;
$input =~ /^\s*(.)/; # skip leading whitespace and return first
# non-whitespace char
}
gabor.
--
Perl itself is usually pretty good about telling you what you
shouldn't do. :-)
-- Larry Wall in <11091@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 14 Feb 1998 12:48:54 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: on reading FAQs and gurus answering questions
Message-Id: <8c3ehm55nd.fsf@gadget.cscaper.com>
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> [courtesy cc of this posting sent to cited author via email]
Tom> In comp.lang.perl.misc, Randal Schwartz <merlyn@stonehenge.com> writes:
Tom> :You can't retrofit clpm as
Tom> :moderated very easily.
Tom> It was done for ciwac.
I didn't say it couldn't be done. I said it couldn't be done "very
easily".
:-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 198 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 14 Feb 1998 00:23:46 -0800 (PST)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: Perl 5 for Win32 Q: How can I determine how a script was executed?
Message-Id: <APC&1'0'50775d8c'5ee@igc.apc.org>
scott@softbase.com wrote:
> Perl is so inherently command line
> oriented that you need an open, stable command prompt to
> run Perl programs.
How so? Could you give an example?
>From my experience perl is omnivorous - it will thrive in lots of
environments, including those that are not command-prompt-centric.
Input can come from config files, or through other wacky ways
(Macperl::Ask, the existance of semaphors (sp?), instructions on a
network port, etc....)
Output can come go to logfiles or be mailed off to
logwatcher.
------------------------------
Date: Sat, 14 Feb 1998 11:54:49 -0500
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <34E5CC59.6C59CFAA@negia.net>
Randal Schwartz wrote:
>
> >>>>> "Dennis" == Dennis Whitney <dennis@ironlight.com> writes:
>
> Dennis> The check I currently use looks something like:
> Dennis> if (($email =~ /\w+@[\w\.]+(com|gov|net|edu|mil|us|org|int)$/)&&
> Dennis> ($email !~ /(!#$%^&*\(\))+/)) {
> Dennis> ... Your code here ...
> Dennis> }
>
> Completely wrong. It rejects the perfectly valid functioning
> <fred&barney@stonehenge.com> address (it's an autoresponder... try it!).
perhaps worse is that the test actually lets fred&barney@stonehenge.com
(without the angle brackets) pass through but for the wrong reasons:
$email = 'fred&barney@stonehenge.com';
if ( ($email =~ /\w+@[\w\.]+(com|gov|net|edu|mil|us|org|int)$/) &&
($email !~ /(!#$%^&*\(\))+/)) {
print $&;
}
yields: barney@stonehenge.com
just for fun i tried decoding the second regex. my guess is that it was
intended as a character class, but in it's current form i am trying to
come up with a string that it will match. so far i have figured everything
out except how to deal with the caret. my guess is that there is no string
for which:
$email =~ /(!#$%^&*\(\))+/
will return true. by adding a \n before the caret then $email = "!#0\n&()"
will match, but i am at a loss as to what will match the original.
any ideas?
--
danboo rstein
------------------------------
Date: Sat, 14 Feb 1998 13:31:43 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Sort help please!
Message-Id: <MPG.f4fad0a263522669896cc@news.concentric.net>
burt@ici.net said...
> This is my text data:
>
> 1"Hugo"Brown"12 Apple St.
> 5"Barnie"Lewis"765 Boulder St.
> All I want to do is to be able to sort by any field (column).
> What I'm trying to do below is sort by field #2 (first names).
> This is what i have so far:
>
> open (FILE,"$infile" ) || die "can't open $indexurl: $!\n";
> @order = (<FILE>);
So far, so good.
> foreach(@order)
> {
> ($number, $fname, $lname, $address1) = split /"/;
> }
This is a waste of typing, sice you're not actually doing anything with those
scalars. Vestigal code?
> @sorted=
> map { $_->[0] }
> sort { $a->[1] <cmp> $b->[1]}
> map { [ $_, (split)[1, 3] ] } #######What this is doing??
> @order;
Close. Take a careful look at the differences between your code and mine,
then go and read
http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html
@sorted =
map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, (split '"')[1] ] }
@order;
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Sat, 14 Feb 1998 17:54:51 GMT
From: Kevin Huber <khuber@yuck.net>
Subject: Re: Substituing Ctrl characters
Message-Id: <uj2vhuiqdg4.fsf@bambi.visi.com>
"Kathleen" == Kathleen Ramsey <kramsey@worldnet.att.net> writes:
Kathleen> How can I substitute Ctrl characters in a file. I have tons
Kathleen> of Office Writer file I need to convert to flat text. All
Kathleen> the info is on one line and there are ^P and ^Q are tabs and
Kathleen> ^Z is a CR LF.
You can go $line=~s/\cM//g, using the \c for prefix control characters.
Kathleen> open (IN,"Filename");
You should always check the result of open.
open(IN,"<$filename") or die "Can't read $filename: $!\n";
------------------------------
Date: Sat, 14 Feb 1998 13:04:53 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Substituing Ctrl characters
Message-Id: <MPG.f4fa6d2735842dd9896c9@news.concentric.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to the
cited author.]
kramsey@worldnet.att.net said...
> How can I substitute Ctrl characters in a file.
Kathy - as an aside, I recommend that you familiarize yourself with your
newsreader's "Cancel Post" command so that you needn't leave two almost
identical posts in a newsgroup.
First, you'll usually want to represent control characters in double-quotish
contexts as "\cz" where z == the control character.
Second, you'll need to use the binmode operator on the filehandle to your
data, or else the ^Z will be interpreted as EOF. (I'm assuming you're on a
Win32 box).
I think you want Perl's built-in "tr" operator, whose syntax is similar to the
match and substitution operators, but is much faster when you're changing
specific characters into other specific characters. You'll find it in perlop.
For now, simply
$string_with_control_characters =~ tr{\cz\cp\cq}{\n\t\t};
And so...
#!/usr/bin/perl
open (DOSFILE, '<dosfile.foo') or die "$!";
binmode DOSFILE;
while (<DOSFILE>) {
tr{\cz\cp\cq}{\n\t\t};
print;
}
close DOSFILE;
__END__
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 14 Feb 1998 17:24:52 GMT
From: jhunterj@lexis-nexis.com (Hunter Johnson)
Subject: Re: Substitution in perl for newbie
Message-Id: <6c4k14$1kl@mailgate.lexis-nexis.com>
In article <34e62d99.174287792@192.168.1.1>, Jerry <nospam@nospam.com> wrote:
> I'm going to get the remote address ip, say 205.213.42.193. I know
> how to do that(amazing). However I want to basically cut off the
> last part of the address so it will be 205.213.42 and that's it.
> Easy right?
Try
s/\.\d+$//;
Or you can split, splice, and join if that's more fun. :-)
Hunter
--
J. Hunter Johnson /\ SJG Errata Coordinator (sjg-errata@io.com)
http://www.io.com/~jhunterj/ /()\ Knightmare Chess Development Coordinator
jhunterj@io.com /____\ The Games of '98 by # of times played:
Gin LamPoker Pitch GMtBrain Robo Catan Set ModArt EmpBuild 1870 Crib GrPrix
------------------------------
Date: Sat, 14 Feb 1998 16:43:43 GMT
From: nospam@nospam.com (Jerry)
Subject: Re: Substitution in perl for newbie
Message-Id: <34e5c9a6.214243351@192.168.1.1>
On Sat, 14 Feb 1998 09:37:56 GMT, Gellyfish@btinternet.com (Jonathan
Stowe) wrote:
>On Sat, 14 Feb 1998 05:41:56 GMT, nospam@nospam.com (Jerry) wrote:
>
>
>>I'm going to get the remote address ip, say 205.213.42.193. I know
>>how to do that(amazing). However I want to basically cut off the last
>>part of the address so it will be 205.213.42 and that's it. Easy
>>right?
>>
>
>$ip="205.213.42.193";
>$ip=~ s/\.\d+$//;
>
>/j\
Thank you very much!!! I have so much to learn that it's not even
funny.
------------------------------
Date: Sat, 14 Feb 1998 12:51:21 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: The Young Man and the Beach
Message-Id: <34E5D999.28434F2D@hotmail.com>
Mark Kramer wrote:
>
> In article <6c2hdq$347@abattoir.cc.ndsu.nodak.edu>,
> Nem W Schlecht <nem@abattoir.cc.ndsu.nodak.edu> wrote:
> >Unfortunately, many of us have left.
>
> And many of us haven't.
>
> >Keep up the good work, Tom. You know you still have a lot of grateful
> >people behind you.
>
> Yes, by all means, keep up the good work. Nobody has said he should
> stop that. Just drop the OS flaming and fables.
Windows, Netscape, AOL, and the like deserve to be flamed. Once upon
a time the rules netiquette were presented _very_ clearly to newbies
before they posted anything. I don't see M$, Netscape, AOL, or
any of the ISPs doing this. They have done a lot of damage to usenet.
This should be made clear to their customers.
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Sat, 14 Feb 1998 13:06:04 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: The Young Man and the Beach
Message-Id: <34E5DD0C.8677B4FF@hotmail.com>
Mark Kramer wrote:
>
> In article <34E45CDC.D6B5D299@ti.com>, Graham Barr <gbarr@ti.com> wrote:
> >Mark Kramer wrote:
> ><ungrateful gibberish deleted>
>
> Ok, Mr. Barr. You tell me, exactly, what I was supposed to be grateful
> for in the fable Tom posted. Was I supposed to be grateful that he
> compared all of us to dirty beggars and shoeless children? Was I
> supposed to be grateful for his reference to all the human debris on
> "his beach"? No, you don't get to exclude yourself from his fable,
> since he did not find any of his old friends on the beach, just the
> rabble.
It is because of him and those like him that you have perl to talk
about anyway. Those people _created_ this beach, if you want
to be here you should play by their rules.
> Or maybe what I was supposed to be grateful for was the way he was
> jumping down people's throats for picking the wrong newsreader to post
> to his group?
>
He doesn't jump down peoples throats for using crappy news readers. He
informs people that their posts are ugly and need to be formatted correctly.
He also makes several humorous and accurate comments about crappy news readers.
Maybe you should thank him for making you aware that better software than
what you are currently using is available for free.
[ sniped more stupid ramblings ]
> As for his "soul" purpose being to "help", well, I can state without
> hesitation that his vendettas helped nobody. It increased the noise
> and drew attention to himself, that's all.
I have found his posts to be tremendously helpful, you would too if you
weren't so busy being defensive.
[ snip ]
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Sat, 14 Feb 1998 17:54:37 +0000
From: John Olsen <jfo@btinternet.com>
Subject: Tom Christiansen
Message-Id: <34E5DA5D.382D@btinternet.com>
Tom's recent posts don't seen to have had much affect!
There was an RFD some time ago about a moderated clpm but there has been
nothing much since. Does it just take a long time or was the idea
abandoned?
------------------------------
Date: Sat, 14 Feb 1998 18:02:59 +0000
From: John Olsen <jfo@btinternet.com>
Subject: Re: Tom Christiansen
Message-Id: <34E5DC52.835@btinternet.com>
Whoops! Should of read the earlier posts discussing same!
------------------------------
Date: Sat, 14 Feb 1998 18:57:50 GMT
From: thijs@kink.xs4all.nl (Thijs Kinkhorst)
Subject: VB5: Win95 sound volume control
Message-Id: <6c4pff$k41$3@news2.xs4all.nl>
Hello,
I'm having some questions on manipulating the Windows sound output. I'm now
able to set the volume on any device by using auxSetVolume from winmm.dll.
I'd like to be able to also get the current volume on any device. Using
QuickView I found the function auxGetVolume in winmm.dll and the API Text
viewer gave me the declaration
Declare Function auxGetVolume Lib "winmm.dll" Alias _
"auxGetVolume" (ByVal uDeviceID As Long, lpdwVolume _
As Long) As Long
but I can't figure out how to use this function. I understand the first
parameter but it's unclear what the second one should be (lpdwVolume).
Whatever I tried, the function returned 0.
Additionally, I'd like to be able to set any device to "mute". I now use
auxSetVolume(5,0)
but I'd rather do this by checking the Mute box on Volume Control.
Any help on this or a reference to more information about winmm.dll is
greatly appreciated.
TIA,
--
Thijs Kinkhorst * Jaze Web Design * ICQ 432406
thijs@kinkhorst.com * http://www.jaze.net * KeyID 0x371EFCB1
------------------------------
Date: Sat, 14 Feb 1998 13:31:53 -0600
From: "dale" <nitecom@concentric.net>
Subject: Re: Where to start.
Message-Id: <6c4s33$r41@examiner.concentric.net>
try this !!
www.cgi-resources.com
Jonathan Stowe wrote in message <34e551cc.3872377@news.btinternet.com>...
>On Fri, 13 Feb 1998 18:11:33 -0500, Brad Atkins <brad@liquid-web.com>
>wrote:
>
>>Hi,
>>
>>I want to try and learn Perl programming, CGI whatever you want to call
>>it. Anyone have any good online tutorials, or have seen some?!
>>
>Brad, brad,brad,
>
>You should have received by now an E-Mail from Nathan Torkington with
>the subject line of WELCOME to comp.lang.perl.misc.
>
>This is not junk mail. I (and no doubt many others ) would suggest
>reading this before making any further posts to this group.
>
>/J\
------------------------------
Date: Fri, 13 Feb 1998 19:19:01 GMT
From: troy@whadda.com (Troy Denkinger)
Subject: Re: Why does this crash Perl 5.004_02 under Win NT?...
Message-Id: <6c4qtg$2vp$1@hirame.wwa.com>
[cc'd via email]
In article <6c41ra$g49$1@nswpull.telstra.net>, "Andrew
Quested" <nospam--webmaster@hsv.com.au> wrote:
>I don't know if the problem is with Perl, with LWP, with NT or something
>else. I have tried using different URLs in there, and it has had the same
>result.
I believe the problem is in your regular expression. You
haven't said exactly what it is you're wanting to do with
that regex, but it looks like you want to strip data out of
the table.
For information on stripping HTML out of your lines, take a
look at the FAQ (perlfaq9).
This code successfully retrieves the page (written for
clarity rather than brevity):
#!/perl/bin -w
use strict;
use LWP::Simple;
use vars qw($fullpage $url);
$url = "http://racetime.com.au/racedata/s9802/r05res.htm";
$fullpage = get($url);
if(defined $fullpage)
{
print $fullpage;
}
else
{
print "Get failed\n";
}
Now to refine the regex. The above scriptlet runs fine on
5.00402 on Win95. Your prior script did cause an error on
the same box.
By the way, 5.00404 isn't hard to compile if you have one of
the appropriate compilers listed in the FAQ. However, the
newer version wouldn't probably have helped here.
Hope this helps.
Troy Denkinger
------------------------------
Date: Sat, 14 Feb 1998 12:12:29 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: Why is Tom Christiansen so rude?
Message-Id: <34E5D07D.D86E7ADD@hotmail.com>
Steffen Beyer wrote:
>
> Kent Perrier <kperrier@Starbase.NeoSoft.COM> wrote:
> > Gellyfish@btinternet.com (Jonathan Stowe) writes:
>
> >> In article <6bv95t$ira$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com
> >> says...
> >>
> >> >For this, Ken invented grep.
> >> >
> >>
> >> This probably is not why Bill G. "invented" the happless find though ;-{
> >>
>
> > But the FSF has provided a functional equivalent of the unix grep for
> > Bill'$ broken OS.
> >
> > Kent
>
> Unfortunately, beginners and poor PC owners might not be aware of that... :-)
If they can figure out how to post to usenet then i think it is reasonable
to expect them to be able to perform some kind of search on the man pages
as well.
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1899
**************************************