[7177] in Perl-Users-Digest
Perl-Users Digest, Issue: 802 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 1 00:22:22 1997
Date: Thu, 31 Jul 97 21:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 31 Jul 1997 Volume: 8 Number: 802
Today's topics:
Re: [Q] Pattern matching syntax <dyrewolf@worldnet.att.net>
Building perl5.004_01 on cygwin32 (Allan Anderson)
Communication between parent and child (Sun Jian)
Re: Configure CC test fails on AIX 4.2.1 (Allan Anderson)
Re: function pointer dereferencing (Pete Jordan)
Re: joining lines in a file (Lydia S. Y. Scharon)
Re: joining lines in a file (Tad McClellan)
keyboard input without carriage return <pauld@itsnet.com>
OLE error in Perl <serginho@alpha.hydra.com.br>
Perl 5 and Website 1.1 <mick.hutton@dial.pipex.com>
Re: PERL 5.004_1 bug? (M.J.T. Guy)
PERL Compiler? <emoz@intr.net>
PerlIS.dll problem or something? <nick@alekto.com>
pls. help - trying to run programs from perl <mikec@dlpco.com>
Powered by Perl Button-Randall or Tom? <jeff@webdesigns1.com>
Re: Print Web Page a la netscape <rootbeer@teleport.com>
printing leading zeros in number <njindal@san-jose.ate.slb.com>
Re: Question ? <eglamkowski@mathematica-mpr.com>
Re: Reading from pipes (dave)
Recursion problems with while and foreach (Jason Bodnar)
Regexp for postal address? (Michael Schuerig)
Re: s/^\s+|\s+$//g; not working correctly on Win32? (Tad McClellan)
Scalar holding the name of a subroutine: calling it <dougsmaglik@earthlink.net>
Re: Splitting a filename (Tad McClellan)
Re: Stripping ^M from a variable. How? <jpm@iti-oh.comNOSPAM>
SUPER NEWBIE PROBLEM <rewards@compusmart.ab.ca>
Re: Too many people in this group are arrogant #*(@# (R <burleigh@hackberry.chem.niu.edu>
Re: Trouble With : Delimited Database (brian d foy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 31 Jul 1997 06:30:18 -0700
From: Adam Grayson <dyrewolf@worldnet.att.net>
Subject: Re: [Q] Pattern matching syntax
Message-Id: <33E0936A.5B06@worldnet.att.net>
Tom Phoenix wrote:
>
> Do you mean that the $i element of @cover has a string for which you want
> to search? First, that element is $cover[$i], not @cover[$i], and Perl
> will usually warn you about that if you ask it to, with -w.
>
> But you can search with the pattern /$cover[$i]/, although it may be
> desirable to use /o. (See the docs for details on /o and why you might or
> might not want to use it.) It's also possible that you want /\Q$cover[$i]/
> or /\$cover\[\$i\]/, if I've misunderstood your question, but the docs
> (or empirical evidence :-) should tell you what you need.
>
> Yes; it doesn't need to be escaped in a regular expression. (Is that what
> you were asking?) But there may happen to be a module which will do what
> you want. :-)
>
> Hope this helps!
>
> --
> Tom Phoenix http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com PGP Skribu al mi per Esperanto!
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
You totally understand, and answered my question perfectly. Thanks!
Adam
------------------------------
Date: 31 Jul 1997 20:08:09 GMT
From: cerebus@mega.megamed.com (Allan Anderson)
Subject: Building perl5.004_01 on cygwin32
Message-Id: <5rqrb9$jq$1@news.wco.com>
I'm trying to build perl5.004_01 on my winNT box, with b18 of the
Cygnus GNU win32 kit installed. I think that I followed the instructions
but I am getting a link error when it firest tryes to build miniperl.
It complains about how in libperl.a(pp_sys.o) there's an undefined
reference to setpwent. Any ideas what might be causing this?
TIA
---
When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
-- Rinzai, ninth century Zen master
------------------------------
Date: 31 Jul 1997 04:20:51 GMT
From: eng50636@leonis.nus.sg (Sun Jian)
Subject: Communication between parent and child
Message-Id: <5rp3r3$lqo@nuscc.nus.sg>
Hi,
I have a parent process who creates a child process.
In my program, there is a variable $flag. When the value
of $flag is changed in the child process, it seems that
the parent process doesn't know and it still sees $flag
with its original value. I would like to know what is the
easiest method for the parent and the child to 'share' the
variable so that when it's changed in either process, the
other process is able to see the change immediately.
Any help is appreciated! Thank you for reading this message.
--
Regards,
Sun Jian
------------------------------
Date: 31 Jul 1997 22:31:06 GMT
From: cerebus@mega.megamed.com (Allan Anderson)
Subject: Re: Configure CC test fails on AIX 4.2.1
Message-Id: <5rr3na$2d9$1@news.wco.com>
Hello, peter....I curretnly trying to build Perl 5.004_01 on an
AIX 4.2.1 machine...I'm using C for AIX, and it seems to work fine.
Are you sure that cc is there? you've tried compiling hello world?
I ask because I recently upgraded from 3.x to 4.2.1, and had to buy
a license for the C complier. This changed between versions...
---
When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
-- Rinzai, ninth century Zen master
------------------------------
Date: Thu, 31 Jul 1997 02:15:00 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: function pointer dereferencing
Message-Id: <memo.19970731031538.24713B@horus.cix.co.uk>
In article <pudge-ya02408000R3007970854590001@news.idt.net>,
pudge@pobox.com (Chris Nandor) wrote:
> # Trouble is, I can immediately envisage situations where I might
> # actually want to /use/ constructs like that.
>
> You mean, aside from Obfuscated Perl contests?
Yup. I'm a helical programmer... ;)
Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"'Not twisted,' Salzy once said of her own
passion, 'it is helical. That sounds better.'"
------------------------------
Date: 31 Jul 1997 17:52:36 -0500
From: lss2@clarion.cec.wustl.edu (Lydia S. Y. Scharon)
Subject: Re: joining lines in a file
Message-Id: <5rr4vk$6f9@clarion.cec.wustl.edu>
Tad,
Thanks for the reply! You gave me my missing piece..
I had gotten it to work on all of the lines, but I was missing the part
that excluded lines with a " at the end.
while ( $line !~ /"$/)
Lydia
------------------------------
Date: Wed, 30 Jul 1997 17:49:06 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: joining lines in a file
Message-Id: <2dgor5.9e3.ln@localhost>
Lydia S. Y. Scharon (lss2@clarion.cec.wustl.edu) wrote:
: I have a quick question. I am trying to a parse a file with a parsing
: script that I have written. But now I have been thrown for a loop. I
: need to search each line and see if it ends with a ". If it doesn't, then
: I need for that line to join with the next line, add a special character,
: and do the search again on the newly formed line before continuing on to
: the next line. I know how to join a list into a single string, but do i
: need to turn this whole file into a list? I also know how to take STDIN
: and do this, but how do you do this to lines in a file?
You should have provided some sample data, and what you wanted it
transformed into. That would likely be more clear than trying to
describe it in English...
Is this what you want?
-----------------------------
#! /usr/bin/perl -w
while (<DATA>) {
$line = $_; # start a new "line"
while ( $line !~ /"$/) { # concat lines until one ends w/double quote
$line .= <DATA>; # WARNING: might run off the end of file...
}
chomp($line);
$line =~ s/\n/@/g; # replace newlines with at sign
print "line: $line\n"; # process the joined "line" here
}
__DATA__
"first line, gets left alone"
"second line
continues on the third"
"fourth
through
sixth lines too"
-----------------------------
outputs:
line: "first line, gets left alone"
line: "second line@continues on the third"
line: "fourth@through@sixth lines too"
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Thu, 31 Jul 1997 15:39:04 -0700
From: "Paul R. DeBry" <pauld@itsnet.com>
Subject: keyboard input without carriage return
Message-Id: <33E11408.17F@itsnet.com>
This may be a stupid question, but how do you receive input from the
keyboard without requiring a carriage return.
All I want is a way to know that a key was pressed and what key it was!
Any help would be GREATLY appreaciated.
Thanks,
Gordon Harkness
--
------------------------------
Date: 31 Jul 1997 19:54:47 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: OLE error in Perl
Message-Id: <01bc9deb$f99ca7c0$ca75e7c8@AFXTD_202.Autofax>
Hi! I try to execute a OLE Perl Script in my machine (This's the first time
that I'm trying to do OLE in Perl) And I didn't get. The Perl Interpreter
tell me :
C:\DOWN\Testes>perl teste.pl
Undefined subroutine &Win32::OLECreateObject called at C:\PERL\LIB/OLE.pm
line 1
03.
C:\DOWN\Testes>perl -v
This is perl, version 5.004_01
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5.0 source kit.
C:\DOWN\Testes>
What's happening ? Isn't My Perl correctly installed ?
Thanks for any anwser...
--
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@mail.serve.com
--------------------------------------------
------------------------------
Date: Thu, 31 Jul 1997 23:27:53 -0700
From: Mick Hutton <mick.hutton@dial.pipex.com>
Subject: Perl 5 and Website 1.1
Message-Id: <33E181E9.1413@dial.pipex.com>
I d/l pw32s306.zip from perl site and followed install/setup
instructions for above setup with website as local server. All works
fine on simple pl scripts except perl shells to DOS to run yet I thought
I had the WIN 95 version and any pl scripts with subroutines in don't
work anyone know what I've missed or if I need anything else?
Any help appreciated
Mick
------------------------------
Date: 31 Jul 1997 10:07:40 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: PERL 5.004_1 bug?
Message-Id: <5rpo5c$ojn@lyra.csx.cam.ac.uk>
Tom Phoenix <rootbeer@teleport.com> wrote:
>Sure. File a bug report and install the patch that you get back. :-) Just
>run the perlbug program and show that this command
>
> perl -we 'printf "%-8.2f\n", 3.14159'
>
>...works differently on 5.004 than on 5.003. Somebody will promptly fix
>this (if they don't have a patch already). If you hurry, it may be fixed
>in 5.004_02. Thanks for noticing!
It does indeed appears to be fixed in the trial version of 5.004_02.
Mike Guy
------------------------------
Date: Wed, 30 Jul 1997 14:42:00 -0400
From: Conference <emoz@intr.net>
Subject: PERL Compiler?
Message-Id: <33DF8AF6.D5D0E035@intr.net>
This may be old news, but I'm new here -- is there a compiler available
for PERL? i.e., can I compile my PERL code into a binary executable?
If so, can you tell me where I can get it?
THANKS!!!
Joel
------------------------------
Date: Thu, 31 Jul 1997 21:03:02 +0300
From: Nick Ioffe <nick@alekto.com>
Subject: PerlIS.dll problem or something?
Message-Id: <33E0D356.CB0B8037@alekto.com>
Hi!
I've encountered some problem using the PerlIS.dll...
I open the socket :
if (socket(S, $AF_INET, $SOCK_STREAM, $proto)){
print "socket opened\n";
}else{
&error("Could not open socket: $!");
}
if (bind(S, $this)) {
print "bind done\n";
}else{
&error("Could not bind socket: $!");
}
if (connect(S,$that)){
print "connected\n";
}else{
&error("Could not connect to $thataddr: $!");
}
while ($a = <S>) {
print $a;
}
and it works from the command line, i.e. I get the answer from the
server,
but when I run is from web with PerlIS.dll i get no response from the
server,
i.e. print doesn't print anything...
Any ideas, gurus?
Your help will be very appreciated,
sincerely Nick
------------------------------
Date: 31 Jul 1997 14:20:03 GMT
From: "Mike Cloppert" <mikec@dlpco.com>
Subject: pls. help - trying to run programs from perl
Message-Id: <01bc9dbb$e8aba720$058d48ce@mikec>
I'm writing a perl script which requires me to run an external program to
generate output for a web page. When I run the perl script from the UNIX
command prompt, I get the correct ouput in the correct format (the output
is HTML for a report). Yet when I run the perl script from the web
browser, I get a server error. The output *seems* to be going somewhere
other than STDOUT, but I cannot confirm this. The script runs fine without
the "system($command)" call from both the command prompt & the browser. I
have tried both "system" and "exec", and I get the same results with both.
I have also tried this in multiple browsers, but the server error persists.
PLEASE HELP me if you can offer any suggestions. Thank you, your help is
GREATLY appreciated.
- - - - - - - - - - - - - - - - - - - - - - - - - -
Mike Cloppert mikec@dlpco.com
Internet Development/ http://www.dlpco.com/
Software Support Engineer
DLP Technologies, Inc.
SCO Premier Service & Support
------------------------------
Date: Thu, 31 Jul 1997 13:19:25 -0500
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Powered by Perl Button-Randall or Tom?
Message-Id: <5rqkq0$ifn@newsops.execpc.com>
Hi All,
I created a couple of Powered by Perl buttons but wanted to
make sure that having the camel from the Programming Perl
book on the button is OK. Also if there are any disclaimers I
may need to state, that would be helpful.
I will post a message as to where to download the buttons after
I get these issues cleared.
--
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com
------------------------------
Date: Thu, 31 Jul 1997 08:15:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Joe Kline <Joe.Kline@sdrc.com>
Subject: Re: Print Web Page a la netscape
Message-Id: <Pine.GSO.3.96.970731081418.20106O-100000@kelly.teleport.com>
On Wed, 30 Jul 1997, Joe Kline wrote:
> What I am looking for is a way to print the web page the way it
> looks viewed through a browser (something similar to the print
> icon in netscape).
Sounds like you want a rendered page. You could either make a renderer in
Perl (if there's not one already) or you could use Netscape or Lynx, which
offer command line options which can render a page. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 31 Jul 1997 14:11:06 -0700
From: Nihar Jindal <njindal@san-jose.ate.slb.com>
Subject: printing leading zeros in number
Message-Id: <33E0FF6A.41C67EA6@san-jose.ate.slb.com>
How do I print the leading zeros in a number? I am printing out a
time and I want the numbers I print to always be 2 digits long, even
if they are less than 10. Example:
$min = 4;
when I print the time I want to print:
4:04.32
I do not want to print: 4:4.32 or 4: 4.32
Using printf with %2d would print " 4" because it will not print
the leading zero. Is there some simple way of doing this?
Nihar Jindal
njindal@san-jose.ate.slb.com
------------------------------
Date: Thu, 31 Jul 1997 16:38:01 -0400
From: the count <eglamkowski@mathematica-mpr.com>
Subject: Re: Question ?
Message-Id: <33E0F7A9.7852@mathematica-mpr.com>
Paul wrote:
> I have written a perl greeting card program that works great except for 1
> minor detail.
> When someone from AOL makes a card, for some reason it triggers the program
> more than once and duplicate cards are created. The happens rarely with
> other providers.
> When I see duplicates, 99% of the time its from a AOL user. Does anyone
> have an explaination or cure ?
yeah, block AOL users from your site ;D
<big grin>
------------------------------
Date: Fri, 01 Aug 1997 01:38:56 GMT
From: over@the.net (dave)
Subject: Re: Reading from pipes
Message-Id: <33e13b04.11005926@news.one.net>
"Ron L. Helms" <helmrl@aur.alcatel.com> wrote:
>I blessed my IO::Pipe to IO::Handle and used $fh->getline to read from a
>pipe. When I know I am sending info (first time), I send "last" as the
>last argument of an array, and the while loop around $fh->getline exits.
>My problem is I need to check at various intervals if there is new info
>on the pipe I need to read. The second time I call $fh->getline, my
>program hangs because there is no new data on the pipe, but $fh->getline
>is still looking for it.
>Is there a way to timeout the process (hopefully not SIGS{}) or test the
>pipe to see if there is data on it before I call $fh->getline?
>Any and all help will be greatly appreciated.
>Ron Helms
>helmrl@aur.alcatel.com
>rhelms@pagesz.net
Pipes are difficult to read without blocking. It's easy to read
message queues without blocking using IPC_NOWAIT. Look at msgget,
msgsnd and msgrcv. I think there is also an OO wrapper for the calls
at CPAN ( IPC::SystemV or something like that).
If you need to read stdout from a program, you could put a wrapper
around the program that reads a pipe and puts it in the message queue.
Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________
------------------------------
Date: Thu, 31 Jul 1997 22:57:41 GMT
From: jason@cimedia.com (Jason Bodnar)
Subject: Recursion problems with while and foreach
Message-Id: <33e1168d.198715626@news.internetmci.com>
This one has blown my mind. I doing some recursion of a tree of files.
(It's an old web bulletin board.) For simplicity sake we'll say that
each file contains a list of it's child files, one on each line. It
all starts in one top level index file.
Originally I had something like this:
open INDEX;
while (<INDEX>) {
recurse($_);
} # End while
close INDEX;
sub recurse {
my $file = shift;
open FILE, $file;
while (<FILE>) {
recurse($_);
} # End while
close FILE;
} # End recurse()
But, when I ran this, it only followed one branch. That is if my files
were:
1
2
5
7
6
3
8
4
9
It would only open 1,2,5,7 or the first child of each file.
Makes no sense, everything is scoped right, right?
So, I looked at some old code I wrote a while back that head messed
with this file structure before and for some reason it used foreach()
instead of while() in the sub. So I changed my code to look like this:
open INDEX;
while (<INDEX>) {
recurse($_);
} # End while
close INDEX;
sub recurse {
my $file = shift;
open FILE, $file;
foreach (<FILE>) { # Using foreach instead of while
recurse($_);
} # End foreach
close FILE;
} # End recurse()
And, by some cruel twist of fate, it works. But why?
--
Jason C. Bodnar
jason@cimedia.com
Internet Programmer
Cox Interactive Media
------------------------------
Date: Thu, 31 Jul 1997 18:57:04 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Regexp for postal address?
Message-Id: <19970731185704690498@rhrz-isdn3-p25.rhrz.uni-bonn.de>
Has anyone come up with or can point me to a regexp that matches postal
addresses of the form
Firstname Lastname
Street or PO Box
City Zip
It's not going to end up in a spam generator, but intended only for
personal use.
Michael
--
Michael Schuerig And your wise men don't know how it feels
mailto:uzs90z@uni-bonn.de to be thick as a brick.
http://www.uni-bonn.de/~uzs90z/ -Jethro Tull, "Thick As A Brick"
------------------------------
Date: Wed, 30 Jul 1997 18:24:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: s/^\s+|\s+$//g; not working correctly on Win32?
Message-Id: <6gior5.el3.ln@localhost>
Thomas Winzig (tsw@pvo.com) wrote:
: Hello,
: I am running Win32 Perl 5.003_07 (build 306) on NT4 server.
: While parsing through a ton of email messages, I am trying to
: strip whitespace from the beginning and end of the message, like so:
: $msg =~ s/^\s+|\s+$//g;
: The problem is, it seems to also be stripping "doubled up newlines" at
: the same time, even the ones INSIDE the string (please bear with me,
: here).
: Since I am not using the 'm' for multiline matching, I would expect the
: pattern above to only remove the whitespace from the beginning and
: ending of my message (the string contained within $msg). That is not the
: case!
I would expect that too. Hmmm...
: Consider this string:
: $msg = qq{
: The first line has a newline in front, and is followed by 2 \n's.
: Here is the second line. It will be followed by 3 \n's.
: };
: OK, now if I parse this $msg with the above expression, I end up with:
^^^^^^^^^^^^^^^
: "The first line has a newline in front, and is followed by 2 \n's.
: Here is the second line. It will be followed by 3 \n's."
I don't think you really end up with that. You asked perl to interpolate
$msg, and then you put some \n sequences in there.
When *I* parse this $msg, I end up with:
-------------------
#!/usr/bin/perl -w
$msg = qq{
The first line has a newline in front, and is followed by 2 \n's.
Here is the second line. It will be followed by 3 \n's.
};
$msg =~ s/^\s*|\s*$//g;
print "'$msg'\n";
-------------------
outputs:
'The first line has a newline in front, and is followed by 2
's.
Here is the second line. It will be followed by 3
's.'
I think you want a q{} instead of qq{} in the above assignment statement ;-)
: Notice the 2 newlines in the middle were cut down to just one!
Looks like incorrect behaviour to me...
: On the other hand, If I use this set of expressions:
: $msg =~ s/^\s+//;
: $msg =~ s/\s+$//;
Those are what Jeffrey Friedl recommends in "Mastering Regular Expressions"
(p290)
I would go with those for two reasons:
1) it actually works (a powerful reason ;-)
2) it would be faster in most cases even if the above regex did work.
: then everything works as planned. The win32 version of perl is
I tried it under Linux with both 5.003 and 5.004.
Got the same results that you do.
Looks like a bug to me...
: apparantly
: going buck wild on the above expression (s/^\s+|\s+$//g;) because of the
: 'g' I would guess. Or am I just wrong, and my original expression *IS*
: behaving correctly? (If so, WHY does it behave that way?)
------------------------------
#!/usr/bin/perl -w
$msg = q{
The first line has a newline in front, and is followed by 2 \n's.
Here is the second line. It will be followed by 3 \n's.
};
$msg =~ s/^\s*|\s*$//g; # changed + to *, so as to match exactly the
# example in Jeffrey's book, which he says
# *will* work.
print "'$msg'\n";
------------------------------
outputs:
'The first line has a newline in front, and is followed by 2 \n's.
Here is the second line. It will be followed by 3 \n's.'
: Thanks for any help...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Thu, 31 Jul 1997 17:44:48 -0500
From: Doug Smaglik <dougsmaglik@earthlink.net>
Subject: Scalar holding the name of a subroutine: calling it
Message-Id: <33E11560.64E4@earthlink.net>
Hi all -
I have a (hopefully) relatively straightforward question regarding
calling a subroutine within a scalar variable.
I am building a scalar variable that will hold the name of a subroutine
I wish to call. I would like to make the call:
$subroutine_name $parameter
however perl is returning a compilation error. How can I call this
subroutine from inside the scalar variable. Any help or suggestions
would be greatly appreciated. You can email me at
dougsmaglik@earthlink.net or just reply to this message.
Thanks!
Doug Smaglik
------------------------------
Date: Wed, 30 Jul 1997 18:35:44 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Splitting a filename
Message-Id: <g4jor5.4n3.ln@localhost>
Daniel GUEGUEN (daniel.gueguen@elantiel.fr) wrote:
: Hello,
: I don't find the solution to split a file name :
: Example :
: $FicName = '<../data/customer.txt';
: ....
: ($Name,$Extension) = split(/here is the problem.../,$FicName);
: $Extension must countain 'txt' and $Name the rest of the string.
-----------------
#!/usr/bin/perl -w
$ficName = '<../data/customer.txt';
($name, $extension) = $ficName =~ /(.*)(\..*)/;
print "name '$name' extension '$extension'\n";
-----------------
: Thank's for your help.
You're welcome.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 31 Jul 1997 19:32:44 GMT
From: "Joshua Marotti" <jpm@iti-oh.comNOSPAM>
Subject: Re: Stripping ^M from a variable. How?
Message-Id: <01bc9de8$79446430$36601ec6@bach>
When you read in the string, then print it out, do you see the ^M? if so,
simply s/^M//g;
Then \n should remove it, perhaps it is viewed as a tab... try s/\t//g;
--
Josh,
Gavin Dragon...
Remove NOSPAM from address...
Ryan Lynch <lynchrl@ucsub.Colorado.EDU> wrote in article
<5rqn95$ktq@lace.colorado.edu>...
> I have a string variable with the following text:
>
> "100 percent AST - Development of the Global Learning and
> Observations to^M Benefit the Environment program in NOAA,
> development of workstations to be^M used in schools,
> development of data center."
>
> What I need is to strip the ^M out of there. I've tried:
>
> $my_string =~ s/\r//g;
> $my_string =~ s/\015//g;
> $my_string =~ s/\n//g;
> $my_string =~ s/\f//g;
>
> but the carriage returns are still there. Any help would be great.
Thanks!
>
>
> -Ryan
>
------------------------------
Date: Thu, 31 Jul 1997 15:42:59 -0600
From: rewards <rewards@compusmart.ab.ca>
Subject: SUPER NEWBIE PROBLEM
Message-Id: <33E106E3.AA758F14@compusmart.ab.ca>
I modified a shopping cart perl script for my WinNT 4.0 (remote) server
and when I go to the URL it asks to open it with notepad.exe or save it
to disk. Opening it I find it starts the html "Content type..."!
Shouldn't it just come up as a web page?
I even wrote a tiny script that prints "hello world" uploaded it and
again it prints it just in a text downloadable format?!?! Is my
server's cgi-bin not set up properly maybe? It looks like it is getting
interpreted but after that it doesn't work.
I would more than appreciate an answer as this is my first week of
programming in PERL and I imagine my question requires a quick answer.
Thanks
Mark Sears
------------------------------
Date: Thu, 31 Jul 1997 16:36:18 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: Too many people in this group are arrogant #*(@# (Re: Checking for valid Email...)
Message-Id: <33E10552.CA@hackberry.chem.niu.edu>
Mike Stok wrote:
>
> In article <71c7cd$cd11.3c2@news.cegelecproj.co.uk>,
> <Steve_Kilbane@cegelecproj.co.uk> wrote:
>
> > [...]
> > You don't. Nor do many, many people. Laziness is wrong, and rife.
> > [...]
>
> Quote taken out of larger context. Is not the phrase "Laziness is wrong"
> near heretical in the light of the preface of Programming Perl (page xiii
> of the second edition) which says:
>
> "We will engourage you to develop the three great virtues of a
> programmer: laziness, impatience and hubris."
>
> Maybe the balance is a little off for someone who posts as a first resort,
> they win on laziness, their impatience may be better sated by reading the
> docs or FAQ, and their hubris may be rewarded by a sound flaming :-)
>
> Mike
>
Right; I start with the a-priori notion that for 99% of the
questions I have, the truth
is out there (probably right in the man pages, or my
good old Camel), and its a lot faster (and reliable)
to find it there
than to wait for my Usenet posting to percolate through
the Net and have the answer get back. On the other hand,
your hubris is rewarded if you can a real stumper of
a question.
==========================================================
- darin
burleigh@hackberry.chem.niu.edu
\\//\\//.\\//\\//.\\//\\//. http://hackberry.chem.niu.edu/HOME/dcb/
'2 kinds of green, look out!' - dieter rot
------------------------------
Date: Thu, 31 Jul 1997 18:49:21 -0500
From: joe@ (brian d foy)
Subject: Re: Trouble With : Delimited Database
Message-Id: <joe-ya02408000R3107971849210001@news.walrus.com>
In article <33E0C810.36241A3A@vcnet.com>, Armando Ortiz <aortiz@vcnet.com> wrote:
[snip]
> This reads in the parameter 'zip' passed to it by the browser and the
> next part of the code opens the database and attempts to match, but when
> it does, it tries to match the whole line with whatever was passed to
> it:
>
> open(newcomzip,"$database") || die "Can't open zipcode.db: $!\n";
which filehandle are you intending to read? you open newcomzip but
read zipcode (btw, filehandles are customarily all uppercase, which makes
them easy to spot in code)
> while (<zipcode>){
> if (/$FORM{'zip'}/){
> ($record, $store, $company, $address, $city, $state, $zip, $phone) =
> split(/:/, $_);
don't you have things a bit out of order there?
# get a line of input
while( $line = <FILE> )
{
# take this colon delimited line and break it up into its bits
# since we don't care what the names are, we will just use an array
my @bits = split /:/, $line;
# compare the zip code from the this line to that entered on the
# form
if( $bits[6] == $FORM{'zip'} ) # or whatever comparison you like
{
#do your HTML thing
}
}
--
brian d foy <comdog@computerdog.com>
------------------------------
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 802
*************************************