[17510] in Perl-Users-Digest
Perl-Users Digest, Issue: 4930 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 20 09:05:32 2000
Date: Mon, 20 Nov 2000 06:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <974729113-v9-i4930@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 20 Nov 2000 Volume: 9 Number: 4930
Today's topics:
Re: 誠意邀請對Perl有興趣的朋友 <tshinnic@io.com>
Beginners Blues II <johngros@Spam.bigpond.net.au>
Re: Beginners Blues II (Honza Pazdziora)
Re: Beginners Blues II <johngros@Spam.bigpond.net.au>
Re: Beginners Blues II <johngros@Spam.bigpond.net.au>
Re: Beginners Blues II <josef.moellers@fujitsu-siemens.com>
Re: Beginners Blues II <johngros@Spam.bigpond.net.au>
Re: Beginners Blues II <josef.moellers@fujitsu-siemens.com>
Re: Beginners Blues II (Tad McClellan)
Re: Beginners Blues II <johngros@Spam.bigpond.net.au>
Re: Beginners Blues II (Honza Pazdziora)
Re: Beginners Blues II <johngros@Spam.bigpond.net.au>
Re: Beginners Blues II <iltzu@sci.invalid>
Re: Beginners Blues II <geoff-at-farmline-dot-com@127.0.0.1>
Check if e-mail bounced with Mail::Bulkmail (Matthijs van den Bos)
Re: Check if e-mail bounced with Mail::Bulkmail (Martien Verbruggen)
Re: Dbase IV to TXT (Honza Pazdziora)
Re: Do I need Java to redirect form parameters? (ntl)
File::Find's results to an array (dionysus)
Re: File::Find's results to an array (dionysus)
Re: File::Find's results to an array (Martien Verbruggen)
Re: Free Online Sample Certification Questions <iltzu@sci.invalid>
Help with installing a package <sladb69@magma.ca>
Re: how do I delete initial and final spaces in a strin <bart.lateur@skynet.be>
Re: how do I delete initial and final spaces in a strin (Garry Williams)
Re: I need a fork example, please <newshunter@knowhunter.cjb.net>
Re: just testing (Tad McClellan)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 20 Nov 2000 09:18:00 GMT
From: Thomas L. Shinnick <tshinnic@io.com>
Subject: Re: 誠意邀請對Perl有興趣的朋友
Message-Id: <mbrh1t43chh04pahsd4v3tr2koi9ni1rlg@4ax.com>
On Sun, 19 Nov 2000 15:42:06 -0600, "Dale Emmons" <dale@emmons.dontspamme.com>
wrote:
>"vic" <vicschanweb@hotmail.com> wrote in message
>news:8v91tv$8502@rain.i-cable.com...
>> 誠意邀請對Perl有興趣的朋友
>> http://easy4u.virtualave.net/
[snip]
>
>what a coincidence, that's exactly what I was thinking!
>
>please, this is an english list. post in english.
Of course, we could say "tw.bbs.comp.lang.perl" to give him a clue...
--
You will live a long time,
long enough to open many, many fortune cookies.
-- Restaurant Fortune Cookie (They know me there ...)
------------------------------
Date: Mon, 20 Nov 2000 10:03:01 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Beginners Blues II
Message-Id: <pF6S5.14339$tU2.120743@news-server.bigpond.net.au>
@name = split (/@/,$name); # splits the email to pre @ and post @
$name = @name(0) + "\\\@" + @name(1); # should add the pre @ (johngros) with
\@ and with post @ (bigpond.net.au).
In the $name = ..... There is a syntax error being a beginner I do not have
a clue where it lies.
Hopefully someone can see it.
------------------------------
Date: Mon, 20 Nov 2000 10:16:40 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Beginners Blues II
Message-Id: <G4BJ7s.MLD@news.muni.cz>
On Mon, 20 Nov 2000 10:03:01 GMT, John Boy Walton <johngros@Spam.bigpond.net.au> wrote:
> @name = split (/@/,$name); # splits the email to pre @ and post @
> $name = @name(0) + "\\\@" + @name(1); # should add the pre @ (johngros) with
> \@ and with post @ (bigpond.net.au).
>
> In the $name = ..... There is a syntax error being a beginner I do not have
> a clue where it lies.
> Hopefully someone can see it.
Perl is intuitive, but it still has some syntactic rules. I guess what
you probably want is
$name =~ s/\@/\\\@/;
or to go along your lines
@name = split /\@/, $name, 2;
$name = $name[0] . '\\@' . $name[1];
Hope this helps,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Mon, 20 Nov 2000 11:40:17 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners Blues II
Message-Id: <B48S5.14541$tU2.121776@news-server.bigpond.net.au>
That helped heaps!
I have been trying to join two strings with +.
I also have tried the substitution method but could not swing it in one line
I had them in quotes and then tried pre loading two variables $replace and
$with.
Thank you for your patience, I also wish to thank lots of others for their
patience.
------------------------------
Date: Mon, 20 Nov 2000 11:55:36 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners Blues II
Message-Id: <Yi8S5.14571$tU2.122530@news-server.bigpond.net.au>
Trying your suggestions I have come up with the following.
#!E:/Millenium Programs/perl/bin/Perl -w
$path = "C:/Program Files/G6FTP/";
$datapath = "ftpdatabase/";
$pwd = time;
$name= <stdin>;
$name = ~s/\@/\\\@/;# preparing an email address to be used as a file name.
$file = $path.$datapath.$name.".txt";
open BOGUS,"+>>$file" or die "Cannot open file: $!";
print BOGUS $pwd;
close BOGUS;
I just get a file called 4294967294.txt
When what I am looking for is johngros@bigpond.net.au.txt
------------------------------
Date: Mon, 20 Nov 2000 13:16:43 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Beginners Blues II
Message-Id: <3A19162B.5FC0CCA5@fujitsu-siemens.com>
John Boy Walton wrote:
> =
> Trying your suggestions I have come up with the following.
> #!E:/Millenium Programs/perl/bin/Perl -w
> $path =3D "C:/Program Files/G6FTP/";
> $datapath =3D "ftpdatabase/";
> $pwd =3D time;
> $name=3D <stdin>;
> $name =3D ~s/\@/\\\@/;# preparing an email address to be used as a file=
name.
=2E........^
Here's a blank that shouldn't be there.
> $file =3D $path.$datapath.$name.".txt";
> open BOGUS,"+>>$file" or die "Cannot open file: $!";
> print BOGUS $pwd;
> close BOGUS;
> =
> I just get a file called 4294967294.txt
> When what I am looking for is johngros@bigpond.net.au.txt
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
------------------------------
Date: Mon, 20 Nov 2000 12:52:58 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners Blues II
Message-Id: <K89S5.14654$tU2.122745@news-server.bigpond.net.au>
Since I removed the space it won't open the file.
It was previously creating a file with the wrong name. I added a print
statement to see what was in $file and got the following.
c:Program Files/G6FTP/ftpdatabase/johngros\@bigpond.net.au.txt
Which is correct!? The @ needs to be escaped in the opening of the file!?
------------------------------
Date: Mon, 20 Nov 2000 13:59:27 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Beginners Blues II
Message-Id: <3A19202F.FFE297F6@fujitsu-siemens.com>
John Boy Walton wrote:
> =
> Since I removed the space it won't open the file.
> It was previously creating a file with the wrong name. I added a print
> statement to see what was in $file and got the following.
> c:Program Files/G6FTP/ftpdatabase/johngros\@bigpond.net.au.txt
> Which is correct!? The @ needs to be escaped in the opening of the file=
!?
Beats me, I never use Windows stuff for anything but playing games.
It may very well be the case that Windows does not want to see an @ sign
in the file name.
Try replacing it by something else, e.g. "(at)", if you need to convert
the name back.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
------------------------------
Date: Mon, 20 Nov 2000 06:54:27 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Beginners Blues II
Message-Id: <slrn91i47j.b8e.tadmc@magna.metronet.com>
On Mon, 20 Nov 2000 11:40:17 GMT, John Boy Walton
<johngros@Spam.bigpond.net.au> wrote:
>I have been trying to join two strings with +.
Why?
That is, what did you read that lead you to believe that that would work?
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 20 Nov 2000 13:12:06 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners Blues II
Message-Id: <Gq9S5.14679$tU2.123863@news-server.bigpond.net.au>
Thats an idea, however I tested it and can save a file called
johngros@bigpond.net.au.txt from windows.
If I hard code in the file name into the script it writes correctly. I think
that maybe the addition of the strings is not quite right.
I might put all the parts in an array and join them.
------------------------------
Date: Mon, 20 Nov 2000 13:09:07 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Beginners Blues II
Message-Id: <G4Br77.DBD@news.muni.cz>
On Mon, 20 Nov 2000 06:54:27 -0500, Tad McClellan <tadmc@metronet.com> wrote:
> On Mon, 20 Nov 2000 11:40:17 GMT, John Boy Walton
>
> >I have been trying to join two strings with +.
>
> That is, what did you read that lead you to believe that that would work?
Maybe have read about DWIM and pushed it to an extreme ;-)
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Mon, 20 Nov 2000 13:26:27 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners Blues II
Message-Id: <7E9S5.14698$tU2.124057@news-server.bigpond.net.au>
Well that was a flop too.
------------------------------
Date: 20 Nov 2000 13:35:20 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Beginners Blues II
Message-Id: <974727147.17605@itz.pp.sci.fi>
In article <slrn91i47j.b8e.tadmc@magna.metronet.com>, Tad McClellan wrote:
>On Mon, 20 Nov 2000 11:40:17 GMT, John Boy Walton
> <johngros@Spam.bigpond.net.au> wrote:
>
>>I have been trying to join two strings with +.
>
>Why?
>That is, what did you read that lead you to believe that that would work?
Java.
Or any other language that abuses arithmetic operators like that.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: Mon, 20 Nov 2000 13:38:49 -0000
From: "Geoff Winkless" <geoff-at-farmline-dot-com@127.0.0.1>
Subject: Re: Beginners Blues II
Message-Id: <8vb9h4$56g$1@soap.pipex.net>
"Ilmari Karonen" <iltzu@sci.invalid> wrote in message
news:974727147.17605@itz.pp.sci.fi...
> In article <slrn91i47j.b8e.tadmc@magna.metronet.com>, Tad McClellan wrote:
> >On Mon, 20 Nov 2000 11:40:17 GMT, John Boy Walton
> > <johngros@Spam.bigpond.net.au> wrote:
> >
> >>I have been trying to join two strings with +.
> >
> >Why?
> >That is, what did you read that lead you to believe that that would work?
>
> Java.
>
> Or any other language that abuses arithmetic operators like that.
umm. why is that abuse? + for concatenation is a perfectly reasonable
mechanism - what would -you- prefer to happen when you attempt to "add two
strings together"?
Geoff
------------------------------
Date: Mon, 20 Nov 2000 12:36:34 GMT
From: mvdbos@integral.nl (Matthijs van den Bos)
Subject: Check if e-mail bounced with Mail::Bulkmail
Message-Id: <3a1919e1.14482744@news.nl.net>
Hello all,
I wrote a mailinglist server using Mail::Bulkmail.
Everything works fine, except the checking of addresses that bounced.
As far as I could see, this module doesn't provide functionality for
this.
I'd like to keep the rest of my script as it is (i.e. keep using
Bulkmail). Does anybody have any idea how to do this?
Thanks.
------------------------------
Date: Mon, 20 Nov 2000 23:49:06 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Check if e-mail bounced with Mail::Bulkmail
Message-Id: <slrn91i7e2.imr.mgjv@martien.heliotrope.home>
On Mon, 20 Nov 2000 12:36:34 GMT,
Matthijs van den Bos <mvdbos@integral.nl> wrote:
> Hello all,
>
> I wrote a mailinglist server using Mail::Bulkmail.
> Everything works fine, except the checking of addresses that bounced.
> As far as I could see, this module doesn't provide functionality for
> this.
>
> I'd like to keep the rest of my script as it is (i.e. keep using
> Bulkmail). Does anybody have any idea how to do this?
Use one of the mail client oriented modules. Check your mailbox. Try to
find all messages that are related to bounces. Try to parse them to
extract what the email address was that the message was originally sent
to.
You'll be surprised how hard it is to get a decent success rate.
You'll probably want Graham Barr's MailTools set of modules.
Martien
--
Martien Verbruggen |
Interactive Media Division | This matter is best disposed of from
Commercial Dynamics Pty. Ltd. | a great height, over water.
NSW, Australia |
------------------------------
Date: Mon, 20 Nov 2000 10:12:08 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Dbase IV to TXT
Message-Id: <G4BJ08.HrB@news.muni.cz>
On Sun, 19 Nov 2000 22:13:24 +0100, Louis <not@here.nl> wrote:
>
> I found this PERL script on the net.
> Can someone point me to a script that convert a dbase IV file to a TAB
> seperate text file?
> Or can someone adjust this script for me???
Go to CPAN and grab the XBase.pm/DBD::XBase module. The documentation
that comes with the module shows its usage and making it to print out
tab separated file is trivial.
Yours,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Mon, 20 Nov 2000 13:49:42 -0000
From: "Alan Dougall (ntl)" <abaltd@ntlworld.com>
Subject: Re: Do I need Java to redirect form parameters?
Message-Id: <O_9S5.7625$3k.152926@news6-win.server.ntlworld.com>
Thx Josh,
--
Alan Dougall
alan.dougall@virgin.net
http://start.at/the.cross
Josh Whitt <jwhitt@webaccess.net> replied:
> > Essentially, the first page asks for details. After checking the
details,
> > the second form "page" needs to forwards these to another site (not
mine!)
> Hi, I'm Josh. There are some options here:
>
> 1) use a GET style URL to pass the parameters, if it's really not
imperative
> that they be hidden:
>
> print redirect
("http://www.foo.bar/myperlprog?param1=nifty¶m2=neato");
I have too many and varied parameters to go down that route!
> 2) print a page with some javascript to trigger the form submit
immediately
I started hunting for one now on http://www.javascript.com - got as far as:
onLoad="this.form.submit()"
but cannot get that working yet!
I guess (knuckles rapped once already!!) I need to direct this to a
different newsgroup, as Mark suggested!
> 3) whip out LWP and post directly to this external script, grab that
> script's output, and print it out from your script.
LWP?
------------------------------
Date: Mon, 20 Nov 2000 10:58:10 GMT
From: dionysus39@hotmail.com (dionysus)
Subject: File::Find's results to an array
Message-Id: <3a1902fb.12127802@nntp.unsw.edu.au>
How would you go about turning File::Find's results into an array?
I have tried using the subroutine
sub wanted {
@files = "$File::Find::name\n";
}
as well as the subroutine
sub wanted {
print "$File::Find::name\n";
}
in conjunction with the code
@files = find(\&wanted, "\\\\$mname\\$share");
but neither seem to work....all I want is each file found by find to
be an element in the array....
thanks in advance for all advice..
-d
------------------------------------------------------------
"One World, one Web, one Program" - Microsoft promotional ad
"Ein Volk, ein Reich, ein Fuhrer" - Adolf Hitler .
------------------------------
Date: Mon, 20 Nov 2000 11:34:10 GMT
From: dionysus39@hotmail.com (dionysus)
Subject: Re: File::Find's results to an array
Message-Id: <3a190b82.14311114@nntp.unsw.edu.au>
Amazing - without even replying, you people act as a catalyst....not 5
minutes after I made this post, I wondered if wanted was only doing
one file at a time, rather than the whole list...and, amazingly
enough, setting wanted to
sub wanted {
$files[++$#files] = "$File::Find::name\n";
}
worked perfectly...oh well, at least anyone searching deja in the
future with the same problem will get a hit on this.....
-d
On Mon, 20 Nov 2000 10:58:10 GMT, in comp.lang.perl.misc
dionysus39@hotmail.com (dionysus) said stuff.
>How would you go about turning File::Find's results into an array?
>I have tried using the subroutine
>
>sub wanted {
> @files = "$File::Find::name\n";
> }
>
>as well as the subroutine
>
>sub wanted {
> print "$File::Find::name\n";
> }
>
>in conjunction with the code
>
>@files = find(\&wanted, "\\\\$mname\\$share");
>
>but neither seem to work....all I want is each file found by find to
>be an element in the array....
>
>thanks in advance for all advice..
>
>-d
>
>------------------------------------------------------------
>"One World, one Web, one Program" - Microsoft promotional ad
>"Ein Volk, ein Reich, ein Fuhrer" - Adolf Hitler .
------------------------------------------------------------
"One World, one Web, one Program" - Microsoft promotional ad
"Ein Volk, ein Reich, ein Fuhrer" - Adolf Hitler .
------------------------------
Date: Mon, 20 Nov 2000 22:46:58 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: File::Find's results to an array
Message-Id: <slrn91i3pi.imr.mgjv@martien.heliotrope.home>
On Mon, 20 Nov 2000 10:58:10 GMT,
dionysus <dionysus39@hotmail.com> wrote:
> How would you go about turning File::Find's results into an array?
> I have tried using the subroutine
>
> sub wanted {
> @files = "$File::Find::name\n";
> }
Almost right.
my @files;
sub wanted { push @files, $File::Find::name }
# .. time passes
@files = ();
find(\&wanted, '/tmp');
> @files = find(\&wanted, "\\\\$mname\\$share");
see above, but I seem to recall that these windows network paths work
fine as
"//$mname/$share"
Normal directories do, so I don't see why this wouldn't.
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: 20 Nov 2000 11:22:24 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Free Online Sample Certification Questions
Message-Id: <974719174.6581@itz.pp.sci.fi>
In article <Kg2S5.597$Bf7.189853184@news.frii.net>, Chris Fedde wrote:
>
>My offer still stands. Anyone who wants a Perl certification may recieve
>one from me. I'll even email you the Postscript file so you can print it
>your self.
Is the file also a working Perl script? (See Bruhat's entries in OPC5.)
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: Mon, 20 Nov 2000 13:55:26 GMT
From: Scott Thornton <sladb69@magma.ca>
Subject: Help with installing a package
Message-Id: <3A192D69.335E0AE3@magma.ca>
I am trying to install the package File::Slurp. I have decompressed it,
and run 'perl makefile.pl. I am now supposed to run 'make' but I don't
have a program named make. I don't have a program named 'nmake' or
'dmake'. My "perl -V:make" command tells me "make = 'nmake';". What am
I supposed to do to make the files?
Scott
------------------------------
Date: Mon, 20 Nov 2000 09:31:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how do I delete initial and final spaces in a string?
Message-Id: <r9rh1toteaagp4g9jnkshiig0fr0frroiu@4ax.com>
Mauro wrote:
>I need to transform data like below:
>
>input:
> fgdfgsdf fgdfgklh fgdfslhjfd | 25,534
>
>output:
>fgdfgsdf fgdfgklh fgdfslhjfd|25,534
Standard space trimming happens like this:
s/^ +//; s/ +$//;
or, more generally, whitespace trimming (incl. newlines):
s/^\s+//; s/\s+$//;
This looks like a pipe delimited file. So I would tend to sp^lit the
data, treat each field individually, and join them back again
afterwards.
$" = "|"; #once
# for each line:
chomp;
my @field = split /\|/;
foreach(@field) {
s/^ +//; s/ +$//;
}
print "@field\n";
You may loose empty trailing fields, which may not be what you want. If
you don't, replace the split expression with:
split /\|/, $_, -1
If you want a regex / set of regexes:
s/^ +//; s/ +$//;
s/ *\| */|/g;
And finally: with split, you can use the pattern / *\| */, which will
kill leading and trailing spaces around the vertical bars.
--
Bart.
------------------------------
Date: Mon, 20 Nov 2000 14:04:52 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: how do I delete initial and final spaces in a string?
Message-Id: <8caS5.1186$xb1.70084@eagle.america.net>
On Mon, 20 Nov 2000 14:45:34 +0930, Wyzelli <wyzelli@yahoo.com> wrote:
>"Garry Williams" <garry@zweb.zvolve.net> wrote in message
>news:jj2S5.1113$xb1.68410@eagle.america.net...
>> On Mon, 20 Nov 2000 14:20:49 +0930, Wyzelli <wyzelli@yahoo.com> wrote:
>> >"Mauro" <-@-.com> wrote in message
>news:8v9tq3$4ge$1@nslave3.tin.it...
>> >
>> >Well, I would use a regex.
>> >
>> >while (<DATA>){
>> > s/\s*(.*\S)\s*\|\s*(.*\S)\s*/$1|$2/;
>> > print "$_\n";
>> >}
>>
>
>Initial spaces and Trailing spaces is in the FAQ, but I havent seen
>anything about a pipe delimited file with extraneous leading, trailing
>and internal spaces before... :)
while ( <DATA> ) {
s/^\s+//;
s/\s+$//;
print join '|', split /\s*\|\s*/;
print "\n";
}
--
Garry Williams
------------------------------
Date: Wed, 15 Nov 2000 10:42:59 +0000
From: "The Know Hunter" <newshunter@knowhunter.cjb.net>
Subject: Re: I need a fork example, please
Message-Id: <8utq4b$a09$1@venus.telepac.pt>
In article <JGsQ5.8070$46.518798@typhoon1.ba-dsg.net>, "Alex Hart"
<news@#nospam#althepal.com> wrote:
>
> I want to fork off a process, run a function, then die. Basically, I
> have a user interface that I want to keep going, but I want to talk to a
> server in the background, without having to wait for the server's
> response.
>
fork (your can see this on perldoc perlfunc page) return 0 to the new
process, the pid of the new process to the fork caller or undef if there
are no new process so, using your own example:
sub ServerTalk {
blah ...
}
fork or ServerTalk() && die;
print " talking to the server right now";
Using the or rule once done, go away, the master process will call fork,
and as fork returns a true value will skipp the && and print "talking".
The child will get and 0 from fork, and run ServerTalk && die. In the
special case that the child process is not started, the master will call
ServerTalk and die himself. If you want to prevent that, you will need to
check if the fork returns 0 or undef.
-- knowhunter --
--------------------------------------------------------------------------
perl -e 's//khy/;s/k/know/;s/h/hunter/;s/y/\@yahoo./;s/\./.com\n/;print;'
--------------------------------------------------------------------------
The Know Hunter - knowhunter@yahoo.com
------------------------------
Date: Mon, 20 Nov 2000 06:58:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: just testing
Message-Id: <slrn91i4er.b8e.tadmc@magna.metronet.com>
On Sun, 19 Nov 2000 21:22:12 -0700, Daniel Cuaron <dcuaron@cs.nmsu.edu> wrote:
> this is a test
This is a *plonk*.
Newsgroups for test postings have the word "test" in their name.
This newsgroup is for discussing Perl, not for testing.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4930
**************************************