[29795] in Perl-Users-Digest
Perl-Users Digest, Issue: 1038 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 16 03:09:42 2007
Date: Fri, 16 Nov 2007 00:09:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 16 Nov 2007 Volume: 11 Number: 1038
Today's topics:
Re: Datastructure <tadmc@seesig.invalid>
Re: Extract Email Address <glex_no-spam@qwest-spam-no.invalid>
Re: Extract Email Address <krahnj@telus.net>
Grep Help <no@spam.tonsjunkmail.com>
Re: Grep Help <peter@makholm.net>
Re: Grep Help <rkb@i.frys.com>
How to add two binary numbers using bitwise AND cyrusgreats@gmail.com
Re: How to add two binary numbers using bitwise AND <joost@zeekat.nl>
Re: How to add two binary numbers using bitwise AND <jimsgibson@gmail.com>
how to run job again <stoupa@practisoft.cz>
new CPAN modules on Fri Nov 16 2007 (Randal Schwartz)
Re: regular expression for digits <stoupa@practisoft.cz>
Re: Rename files using directory names <krahnj@telus.net>
Re: Syntax for a slice of a hashref xhoster@gmail.com
Re: Syntax for a slice of a hashref <tadmc@seesig.invalid>
Re: Two Perl programming questions <tadmc@seesig.invalid>
Re: Two Perl programming questions <justin.0711@purestblue.com>
Re: using a function in map? <tadmc@seesig.invalid>
Re: Using fork() <BLOCKSPAMfishfry@your-mailbox.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Nov 2007 00:42:44 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Datastructure
Message-Id: <slrnfjppba.4rc.tadmc@tadmc30.sbcglobal.net>
Bioperler <bio@perls.pam> wrote:
> Peter Makholm wrote:
>> push @{ $HoAoA{hash1}[2] }, "seventh";
> Thanks! This works. Seems as I have to read a little bit about that :-)
You can do that with:
perldoc perlreftut
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 15 Nov 2007 17:33:24 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Extract Email Address
Message-Id: <473cd745$0$3574$815e3792@news.qwest.net>
M wrote:
> I am writing some house keeping scripts for my email server. I wrote the
> following to extract email address from string.
>
> my $imap_pos = rindex($mailfile, "imap");
> my $maildir_pos = rindex($mailfile, "Maildir");
> my $user_string = substr($mailfile, $imap_pos+5, $maildir_pos-$imap_pos-6);
> my $slash_pos = rindex($user_string, "/");
> my $domain = substr($user_string, 0, $slash_pos);
> my $user_name = substr($user_string, $slash_pos+1, 40);
> my $email_account = "$user_name"."\@"."$domain\n";
>
> $Mailfile basically looks like this.
>
> /home/accountname/imap/some_domain_name_.net/username/Maildir/new/
>
> Can someone point me in a neater way to do this? This works fine though.
>
> M
>
>
my ($domain, $username ) = (split /\//, $mailfile) [4,5];
my $email_account = $username . '@' . $domain;
------------------------------
Date: Fri, 16 Nov 2007 02:33:12 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: Extract Email Address
Message-Id: <473D0144.94AF0923@telus.net>
M wrote:
>
> I am writing some house keeping scripts for my email server. I wrote the
> following to extract email address from string.
>
> my $imap_pos = rindex($mailfile, "imap");
> my $maildir_pos = rindex($mailfile, "Maildir");
> my $user_string = substr($mailfile, $imap_pos+5, $maildir_pos-$imap_pos-6);
> my $slash_pos = rindex($user_string, "/");
> my $domain = substr($user_string, 0, $slash_pos);
> my $user_name = substr($user_string, $slash_pos+1, 40);
> my $email_account = "$user_name"."\@"."$domain\n";
>
> $Mailfile basically looks like this.
>
> /home/accountname/imap/some_domain_name_.net/username/Maildir/new/
>
> Can someone point me in a neater way to do this? This works fine though.
my ( $user_string ) = $mailfile =~ m!imap/(.+?)/Maildir!;
my $email_account = join( '@', ( $user_string =~ m!(.+)/(.+)! )[ 1, 0 ]
) . "\n";
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 15 Nov 2007 23:56:10 -0600
From: "M" <no@spam.tonsjunkmail.com>
Subject: Grep Help
Message-Id: <13jqc7p9olgohd2@corp.supernews.com>
Normally this would search an array for a given string:
if (grep /^X-Spam-Flag: YES/, @data)
Instead of searching for "X-Spam-Flag: YES" I want to search for
"X-Spam-Level: **********". Meaning a message has scored 10 spam points.
How do I make that work? It seems to choke due to the * character.
M
------------------------------
Date: Fri, 16 Nov 2007 06:30:10 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: Grep Help
Message-Id: <87ve82og7h.fsf@hacking.dk>
"M" <no@spam.tonsjunkmail.com> writes:
> if (grep /^X-Spam-Flag: YES/, @data)
>
> Instead of searching for "X-Spam-Flag: YES" I want to search for
> "X-Spam-Level: **********". Meaning a message has scored 10 spam points.
> How do I make that work? It seems to choke due to the * character.
You question seems to be how to match to stars in a regular
expression. As stars have a special meanig in regular expressions
you'lll have to escape them:
/X-Spam-Level: \*\*\*\*\*\*\*\*\*\*/
or better
/X-Spam-Level: \*{10}/
//Makholm
------------------------------
Date: Fri, 16 Nov 2007 00:03:19 -0800 (PST)
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: Grep Help
Message-Id: <b05338f5-60d7-4d3e-a490-dad3e9a90fcb@i29g2000prf.googlegroups.com>
On Nov 15, 9:56 pm, "M" <n...@spam.tonsjunkmail.com> wrote:
> Normally this would search an array for a given string:
>
> if (grep /^X-Spam-Flag: YES/, @data)
>
> Instead of searching for "X-Spam-Flag: YES" I want to search for
> "X-Spam-Level: **********". Meaning a message has scored 10 spam points.
> How do I make that work? It seems to choke due to the * character.
>
> M
/^X-Spam-Level: \*{10}/
------------------------------
Date: Thu, 15 Nov 2007 15:45:28 -0800 (PST)
From: cyrusgreats@gmail.com
Subject: How to add two binary numbers using bitwise AND
Message-Id: <c364431c-3ab1-4a24-bb5f-3d5c017a079c@i12g2000prf.googlegroups.com>
I like to know how to add two binaary numbers using bitwise AND
something like that:
$bin_1 = 1011101000001
$bin_2 = 1000101010101
$result = 1000101000001
basically user enter two decimal numbers and code change those numbers
to binary then using bitwise prints the value/result the convert the
value to hex numbers.
Thanks in advance..
------------------------------
Date: 16 Nov 2007 00:56:33 GMT
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: How to add two binary numbers using bitwise AND
Message-Id: <473ceac1$0$7574$e4fe514c@dreader25.news.xs4all.nl>
On Thu, 15 Nov 2007 15:45:28 -0800, cyrusgreats wrote:
> I like to know how to add two binaary numbers using bitwise AND
> something like that:
> $bin_1 = 1011101000001
> $bin_2 = 1000101010101
> $result = 1000101000001
That's not addition.
> basically user enter two decimal numbers and code change those numbers
> to binary then using bitwise prints the value/result the convert the
> value to hex numbers.
> Thanks in advance..
Look up "bitwise and" in perlop.
Joost.
------------------------------
Date: Thu, 15 Nov 2007 17:15:59 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: How to add two binary numbers using bitwise AND
Message-Id: <151120071715591880%jimsgibson@gmail.com>
In article
<c364431c-3ab1-4a24-bb5f-3d5c017a079c@i12g2000prf.googlegroups.com>,
<cyrusgreats@gmail.com> wrote:
> I like to know how to add two binaary numbers using bitwise AND
> something like that:
> $bin_1 = 1011101000001
> $bin_2 = 1000101010101
> $result = 1000101000001
>
> basically user enter two decimal numbers and code change those numbers
> to binary then using bitwise prints the value/result the convert the
> value to hex numbers.
> Thanks in advance..
Use the 'and' ('&') operator:
#!/usr/local/bin/perl
use warnings;
use strict;
my $bin_1 = 0b1011101000001;
my $bin_2 = 0b1000101010101;
my $result = ($bin_1 & $bin_2);
printf " bin_1: %13b (%d)\n bin_2: %13b (%d)\nresult: %13b (%d)\n",
$bin_1, $bin_1, $bin_2, $bin_2, $result, $result;
__OUTPUT__
bin_1: 1011101000001 (5953)
bin_2: 1000101010101 (4437)
result: 1000101000001 (4417)
See 'perldoc perlop' and search for "Bitwise And" and "Bitwise String
Operators".
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Fri, 16 Nov 2007 06:28:06 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: how to run job again
Message-Id: <fhj9ua$ohb$2@ns.felk.cvut.cz>
This is not perl specific question but I programmed it in perl ;-)
I have script as cron job which download something from internet. If all
requested servers work then script run about 30 hours. But sometime some
server fail and my script stop for http read error. I create 30 cron jobs in
1 hour time interval. At script begin I test if some file is on disk and if
yes then what time is writed in this file. When the time is older then 120
minutes then I run script, in other case I assume that script is still
running and exit from new cron job. If this file not exist then I create it
and update time in file after all web read. I have LWP timeout set to 30
seconds.
I thinked about to run script once only and if some http read error occur
then sleep script for 60 minutes and restat it from begin, but this is not
good idea I think.
Have anybody some better idea how to guarantee that script complete work
even if some errors occur on servers I read?
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Fri, 16 Nov 2007 05:42:18 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Nov 16 2007
Message-Id: <JrL3uI.1zz7@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Astro-satpass-0.015
http://search.cpan.org/~wyant/Astro-satpass-0.015/
----
Business-Billing-TMobile-UK-0.15
http://search.cpan.org/~srshah/Business-Billing-TMobile-UK-0.15/
The fantastic new Business::Billing::TMobile::UK!
----
CPAN-Reporter-1.06
http://search.cpan.org/~dagolden/CPAN-Reporter-1.06/
Adds CPAN Testers reporting to CPAN.pm
----
Catalyst-Controller-SOAP-0.0.4
http://search.cpan.org/~druoso/Catalyst-Controller-SOAP-0.0.4/
Catalyst SOAP Controller
----
Class-Default-1.51
http://search.cpan.org/~adamk/Class-Default-1.51/
Static calls apply to a default instantiation
----
Config-Model-0.615
http://search.cpan.org/~ddumont/Config-Model-0.615/
Model to create configuration validation tool
----
Custom-Log-0.01
http://search.cpan.org/~jconerly/Custom-Log-0.01/
Yes... Another OO-ish logging module.
----
DBIx-Class-Schema-Loader-0.04004
http://search.cpan.org/~ilmari/DBIx-Class-Schema-Loader-0.04004/
Dynamic definition of a DBIx::Class::Schema
----
Data-Hive-0.051
http://search.cpan.org/~hdp/Data-Hive-0.051/
convenient access to hierarchical data
----
Data-Package-1.04
http://search.cpan.org/~adamk/Data-Package-1.04/
Base class for packages that are purely data
----
Data-Toolkit-0.3
http://search.cpan.org/~afindlay/Data-Toolkit-0.3/
----
DateTime-Format-Natural-0.59
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.59/
Create machine readable date/time with natural parsing logic
----
Devel-Hide-0.0008
http://search.cpan.org/~ferreira/Devel-Hide-0.0008/
Forces the unavailability of specified Perl modules (for testing)
----
EV-Watcher-Bind-0.00001
http://search.cpan.org/~dmaki/EV-Watcher-Bind-0.00001/
----
Fuse-0.09
http://search.cpan.org/~dpavlin/Fuse-0.09/
write filesystems in Perl using FUSE
----
Fuse-PDF-0.02
http://search.cpan.org/~cdolan/Fuse-PDF-0.02/
Filesystem embedded in a PDF document
----
Games-Hack-Live-0.405
http://search.cpan.org/~pmarek/Games-Hack-Live-0.405/
Perl script to ease playing games
----
Games-Hack-Live-0.406
http://search.cpan.org/~pmarek/Games-Hack-Live-0.406/
Perl script to ease playing games
----
Games-Hack-Patch-x86_64-0.1
http://search.cpan.org/~pmarek/Games-Hack-Patch-x86_64-0.1/
----
Games-Hack-Patch-x86_64-0.12
http://search.cpan.org/~pmarek/Games-Hack-Patch-x86_64-0.12/
----
IPTables-libiptc-0.04
http://search.cpan.org/~hawk/IPTables-libiptc-0.04/
Perl extension for iptables libiptc
----
Mac-iTunes-Library-XML-0.01_01
http://search.cpan.org/~dinomite/Mac-iTunes-Library-XML-0.01_01/
----
Mac-iTunes-XML-0.01_01
http://search.cpan.org/~dinomite/Mac-iTunes-XML-0.01_01/
----
Mail-DKIM-0.29_3
http://search.cpan.org/~jaslong/Mail-DKIM-0.29_3/
Signs/verifies Internet mail with DKIM/DomainKey signatures
----
MooseX-Policy-SemiAffordanceAccessor-0.02
http://search.cpan.org/~drolsky/MooseX-Policy-SemiAffordanceAccessor-0.02/
A policy to name accessors foo() and set_foo()
----
MooseX-StrictConstructor-0.01
http://search.cpan.org/~drolsky/MooseX-StrictConstructor-0.01/
Make your object constructors blow up on unknown attributes
----
MooseX-StrictConstructor-0.02
http://search.cpan.org/~drolsky/MooseX-StrictConstructor-0.02/
Make your object constructors blow up on unknown attributes
----
Net-Jabber-Bot-2.0.0
http://search.cpan.org/~toddr/Net-Jabber-Bot-2.0.0/
Automated Bot creation with safeties
----
Net-Twitter-Diff-0.04
http://search.cpan.org/~tomyhero/Net-Twitter-Diff-0.04/
Twitter Diff
----
Net-Whois-Raw-1.36
http://search.cpan.org/~despair/Net-Whois-Raw-1.36/
Get Whois information for domains
----
Parallel-Iterator-1.00
http://search.cpan.org/~andya/Parallel-Iterator-1.00/
Simple parallel execution
----
Parse-Eyapp-1.087
http://search.cpan.org/~casiano/Parse-Eyapp-1.087/
Extensions for Parse::Yapp
----
RDF-Query-1.501
http://search.cpan.org/~gwilliams/RDF-Query-1.501/
An RDF query implementation of SPARQL/RDQL in Perl for use with RDF::Redland and RDF::Core.
----
RTx-EmailCompletion-0.03
http://search.cpan.org/~nchuche/RTx-EmailCompletion-0.03/
Add auto completion on RT email fields
----
SQL-Interp-1.05
http://search.cpan.org/~markstos/SQL-Interp-1.05/
Interpolate Perl variables into SQL statements
----
Scriptalicious-1.13
http://search.cpan.org/~samv/Scriptalicious-1.13/
Make scripts more delicious to SysAdmins
----
Scriptalicious-1.14
http://search.cpan.org/~samv/Scriptalicious-1.14/
Make scripts more delicious to SysAdmins
----
ShipIt-Step-Twitter-0.01
http://search.cpan.org/~marcel/ShipIt-Step-Twitter-0.01/
ShipIt step to announce to upload on Twitter
----
Socket-GetAddrInfo-0.02
http://search.cpan.org/~pevans/Socket-GetAddrInfo-0.02/
a wrapper for Socket6's getaddrinfo and getaddrinfo, or emulation for platforms that do not support it
----
Socket-GetAddrInfo-0.03
http://search.cpan.org/~pevans/Socket-GetAddrInfo-0.03/
a wrapper for Socket6's getaddrinfo and getaddrinfo, or emulation for platforms that do not support it
----
Task-1.03
http://search.cpan.org/~adamk/Task-1.03/
The successor to Bundle:: for installing sets of modules
----
Test-Group-0.11
http://search.cpan.org/~domq/Test-Group-0.11/
Group together related tests in a test suite
----
Test-Harness-3.02
http://search.cpan.org/~andya/Test-Harness-3.02/
Run Perl standard test scripts with statistics
----
Test-SubCalls-1.07
http://search.cpan.org/~adamk/Test-SubCalls-1.07/
Track the number of times subs are called
----
Text-Pipe-0.04
http://search.cpan.org/~marcel/Text-Pipe-0.04/
Common text filter API
----
Text-Pipe-Bundle-0.02
http://search.cpan.org/~marcel/Text-Pipe-Bundle-0.02/
install Text::Pipe and derived distributions
----
Trigger-0.01
http://search.cpan.org/~suzuki/Trigger-0.01/
Trigger framework
----
Trigger-0.02_01
http://search.cpan.org/~suzuki/Trigger-0.02_01/
Trigger framework
----
WWW-StreetMap-0.16
http://search.cpan.org/~srshah/WWW-StreetMap-0.16/
Interface to http://www.streetmap.co.uk/
----
WebService-MusicBrainz-0.12
http://search.cpan.org/~bfaist/WebService-MusicBrainz-0.12/
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 16 Nov 2007 06:14:16 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: regular expression for digits
Message-Id: <fhj9u9$ohb$1@ns.felk.cvut.cz>
Abanowicz Tomasz wrote:
> Hello
> My @files array contains file names:
> 11.jpg
> 111.jpg
> 0121.pic
> 1.gif
> 1
> pic 1 cool.gif
> aaa1bbb.jpg
>
> I would like to "grep" files containing "1" digit and not "11", "111",
> "0121" etc.:
> 1.gif
> 1
> pic 1 cool.gif
> aaa1bbb.jpg
>
Maybe this can help you (image name I assume in $var)
if(($var =~ s/1/1/g) == 1) { do something }
or this
if($var =~m/^[^1]*1[^1]*\.\D+) { do something }
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Fri, 16 Nov 2007 02:25:53 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: Rename files using directory names
Message-Id: <473CFF8D.7BF86DCE@telus.net>
Peter Jamieson wrote:
>
> "John W. Krahn" <krahnj@telus.net> wrote in message
> news:473C959D.2992BC4C@telus.net...
> >
> > John
> > --
> > use Perl;
> > program
> > fulfillment
Please don't quote sigs. TIA
> Thanks John!....your comments have been most useful.
> I will need to look at the use of "next" and "return" in
> more detail....cheers, Peter
next (and last and redo) are loop (for, foreach, while, until and {})
control keywords.
perldoc perlsyn (specifically the "Loop Control" section.)
return is a keyword specifically for the purpose of returning from
subroutines.
perldoc perlsub
John
--
use Perl;
program
fulfillment
------------------------------
Date: 15 Nov 2007 23:44:20 GMT
From: xhoster@gmail.com
Subject: Re: Syntax for a slice of a hashref
Message-Id: <20071115184423.663$zQ@newsreader.com>
David Filmer <usenet@davidfilmer.com> wrote:
> I want to do something like this:
>
> $hash_ref->{'key1', 'key2'} = @two_things;
>
> but I wind up with:
>
> $hash_ref{'key1key2'} == 2
>
> A couple of other guesses were also unsuccessful.
>
> What is the proper syntax for this?
Alas, there is no arrow syntax for slices. You have
to use the sigil syntax:
@{$hashref}{'key1', 'key2'} = @two_things;
which gets ugly when the actual ref is not a simple scalar.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Fri, 16 Nov 2007 00:42:45 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Syntax for a slice of a hashref
Message-Id: <slrnfjppns.4rc.tadmc@tadmc30.sbcglobal.net>
David Filmer <usenet@davidfilmer.com> wrote:
> I want to do something like this:
>
> $hash_ref->{'key1', 'key2'} = @two_things;
>
> but I wind up with:
>
> $hash_ref{'key1key2'} == 2
>
> A couple of other guesses were also unsuccessful.
>
> What is the proper syntax for this?
Apply "Use Rule 1" from perlreftut.pod.
I like to use 3 steps:
1) @hash{'key1', 'key2'} = @two_things; # pretend it is a plain hash
2) @{ }{'key1', 'key2'} = @two_things; # replace the name with a block
# fill in the block with the appropriate type of reference
3) @{$hash_ref}{'key1', 'key2'} = @two_things;
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 16 Nov 2007 00:42:44 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Two Perl programming questions
Message-Id: <slrnfjpp3o.4rc.tadmc@tadmc30.sbcglobal.net>
Tim <TimKnoll@gmail.com> wrote:
> I'm just starting out with Perl and I have two questions:
Then there should be two separate posts, each with a Subject
header that indicates the subject of your article.
Subject: Two Perl programming questions
Does not tell us what your article is about.
Please see the Posting Guidelines that are posted here frequently.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 15 Nov 2007 16:58:40 -0000
From: Justin C <justin.0711@purestblue.com>
Subject: Re: Two Perl programming questions
Message-Id: <27c6.473c7ac0.df5ae@zem>
On 2007-11-15, Tim <TimKnoll@gmail.com> wrote:
> File::Find works great to the get the values I need and I know how to
> read the values from a flat file. Would my Perl just create the HTML
> as output? I have two dropdowns. I wanted to make the second ones
> contents dynamic based off what they select for the first.
If the two drop-downs are on the same web-page, then that's not HTML,
it's javascript. You can't 'run' perl on the client machine - you can
serve a page, but you can't make the page alter once it's been served.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Thu, 15 Nov 2007 05:56:50 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: using a function in map?
Message-Id: <slrnfjod02.prv.tadmc@tadmc30.sbcglobal.net>
bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
> I'm doing this:
>
> my @new_data = map { myfunc($_) } @old_data;
>
> the body of myfunc is quite significant, and
> this has worked well for me so far. The arrays
> are arrays of complex data structures.
>
> However, a change in requirment means that I now
> what to be able to remove some of the elements
> of old_data (in other words, not have them appear in @new_data).
>
> But (as far as I can tell) there is NO value
> returnable by myfunc that will do this for me.
>
> If myfunc returns undef, I simply get an undef
> in @new_data.
>
> Advice on how to proceed welcome.
return the empty list.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 15 Nov 2007 19:24:33 -0800
From: fishfry <BLOCKSPAMfishfry@your-mailbox.com>
Subject: Re: Using fork()
Message-Id: <BLOCKSPAMfishfry-ECD73F.19243315112007@comcast.dca.giganews.com>
In article <1194970511.814528.228370@22g2000hsm.googlegroups.com>,
Q <qalex1@gmail.com> wrote:
> I'm trying to use fork and have the processes interact with each
> other... Is this possible? Something like:
>
> my $pid = fork();
> my $gotit = 0;
>
> if ($pid) {
> while (1) {
> if $gotit = 0 {
> <do a thing>
> $gotit = 1;
> }
> }
> } else {
> while (1) {
> my $input = <STDIN>;
> print $input;
> $gotit = 0; #when I get input, I want to set gotit back to 0 so
> the parent starts again.
> }
> }
Other responders didn't mention this so I wanted to point out that your
basic understanding is incorrect. Post-fork, the two processes do not
share the same memory space. The variable $gotit belonging to the parent
is not the same as the one belonging to the child.
In order for the two programs to communicate, they need to use sockets,
pipes, shared memory segments, or signals, as others pointed out
(assuming this is on a Un*x-like system).
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 1038
***************************************