[12752] in Perl-Users-Digest
Perl-Users Digest, Issue: 162 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 16 02:07:19 1999
Date: Thu, 15 Jul 1999 23:05:11 -0700 (PDT)
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, 15 Jul 1999 Volume: 9 Number: 162
Today's topics:
Re: $50 for solution to this perl/mail problem (brian d foy)
Re: C-like #define macros in Perl <uri@sysarch.com>
Re: DBI - alternate row colors (brian d foy)
Re: Get Time , Less Than a second (Larry Rosler)
Re: help with perl (Abigail)
Re: How can I use image as a submit botton ? (Abigail)
Re: long explanations wearying (was Re: Top 10 response (Abigail)
Re: loop problems ?? (Abigail)
Re: MYSQL - Help (Abigail)
Re: Newbie needs help: Environment variables (Abigail)
Re: ok, DBI alt row colors - phrased better w/code <pmallasch@thestarpress.com>
Re: Old database is erased when I add new information (John Stanley)
Problem with Perldoc in Perl 5.005_02 <tbw@netcom13.netcom.com>
Re: regular expression <uri@sysarch.com>
Re: using ParseWords (brian d foy)
Re: using slices in a hash of a hash <kelly@pcocd2.intel.com>
Re: Why we can't do this !? (Anno Siegel)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Jul 1999 00:38:57 -0500
From: brian@pm.org (brian d foy)
Subject: Re: $50 for solution to this perl/mail problem
Message-Id: <brian-1607990038570001@44.bloominton-01rs13-14rt.il.dial-access.att.net>
In article <7mma76$43a$1@nnrp1.deja.com>, newsmf@bigfoot.com wrote:
>Hi -
>whoever sends me a solution to this first, gets a $50 Citibank check in
>the mail. Thanks a lot for your help.
save your money and get a copy of the latest Perl Journal. besides,
$50 doesn't buy you much programmer time.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: 16 Jul 1999 01:44:33 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: C-like #define macros in Perl
Message-Id: <x7u2r5kv26.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@delanet.com> writes:
A> Uri Guttman (uri@sysarch.com) wrote on MMCXLV September MCMXCIII in
A> && do i have to post that use of -P here?
A> No, you don't have to. You can, if you wish. You can email it as well.
A> Just do whatever you want; just don't be off topic.
here it comes. a very legitimate use for -P. it took several readers
some time before they could grok why this was needed. this post seemed
to answer it the best.
--------------------
as i said to greg, it does look better when there are 15+ KEY code pieces
in the same file and i want to play around with them. with -P i can
modify only one copy and all the sort tests are changed. just what a c
macro should be used for. this is a code management problem not a code
prettying one. but it does look better too! but i wouldn't do it outside
of this sort benchmark scaffold environment i created.
here is a copy of the relevent part of a test program. you can see the
use of KEY and why it makes sense. the final version of this test will
have at least 3 more sort tests. i will also be playing with the data
set and KEY code here. and there will be several files like this testing
different data sets. the -P trick will be very nice for them too.
uri
#define KEY1( arg ) substr( arg, 5, 1 )
#define KEY2( arg ) substr( arg, 25, 2 )
#define KEY3( arg ) substr( arg, 75, 3 )
#ifndef KEY1
sub KEY1 { substr( $_[0], 5, 1 ) }
sub KEY2 { substr( $_[0], 25, 2 ) }
sub KEY3 { substr( $_[0], 75, 5 ) }
#endif
sub naive {
@{$out_ref} = sort {
KEY1( $a ) cmp KEY1( $b )
or
KEY2( $a ) cmp KEY2( $b )
or
KEY3( $a ) cmp KEY3( $b )
} @{$in_ref} ;
}
sub OM {
@{$out_ref} = sort {
( $cache1{ $a } ||= KEY1( $a ) ) cmp
( $cache1{ $b } ||= KEY1( $b ) )
or
( $cache2{ $a } ||= KEY2( $a ) ) cmp
( $cache2{ $b } ||= KEY2( $b ) )
or
( $cache3{ $a } ||= KEY3( $a ) ) cmp
( $cache3{ $b } ||= KEY3( $b ) )
} @{$in_ref} ;
}
sub ST {
@{$out_ref} =
map $_->[0],
sort {
$a->[1] cmp $b->[1]
or
$a->[2] cmp $b->[2]
or
$a->[3] cmp $b->[3]
}
map [ $_, KEY1( $_ ),
KEY2( $_ ),
KEY3( $_ ) ],
@{$in_ref} ;
}
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Fri, 16 Jul 1999 00:37:27 -0500
From: brian@pm.org (brian d foy)
Subject: Re: DBI - alternate row colors
Message-Id: <brian-1607990037270001@44.bloominton-01rs13-14rt.il.dial-access.att.net>
In article <APC&1'0'50775d93'bf6@igc.apc.org>, Michael de Beer
<madebeer@igc.apc.org> wrote:
>As you loop through the row results, have a counter variable, $i.
>
># pseudocode
>if ( ($i mod 2) == 0)) {
> print "<FONT COLOR=green>\n";
>} else {
> print "<FONT COLOR=red>\n";
>}
why have separate branches of code for the same thing?
my @colors = qw( ... );
my $index = 0;
while( $sth->fetch )
{
.....
print qq|<td bgcolor='$colors[$index]'>|;
.....
$index++;
$index = $index % $#colors;
}
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Thu, 15 Jul 1999 21:54:45 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Get Time , Less Than a second
Message-Id: <MPG.11f85aed14798f7d989ce2@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <378e8798.7320295@news.inet.co.th> on Fri, 16 Jul 1999
01:21:02 GMT, Ryan Ngi <ryanngi@hotmail.com> says...
> i want to see that which each takes longer time between alogrithm #1
> and algorithm #2..... i use this;
...
> but the two algorithms take time less than a second that the variable
> "time" is not suitable...... how to fix this!!!
perlfaq8: "How can I measure time under a second?"
You might also consider usin the Benchmark module to measure the code
executing in a loop.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 16 Jul 1999 00:06:48 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: help with perl
Message-Id: <slrn7otfe9.c9j.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCXLIV September MCMXCIII
in <URL:news:378eca0e.18379497@news.skynet.be>:
&& Jim Britain wrote:
&&
&& >Now, a workaround for Winzip, is simply to replace the _ character
&& >with a dot character, and Winzip will now recognize that after it has
&& >gotten rid of that gz stuff, it has another kind of file that it knows
&& >something about -- a tar file in the temp directory, and will ask if
&& >you want to expand and display the tar file..
&&
&& Changing the extension from ".gz" to ".tgz" (short for ".tar.gz") works
&& too.
Oh, golly. Bart tries to be smart again. Too bad he couldn't control
himself and had to post before reading the rest of what Jim had to say:
> There's another method, too, change the name to stable.tgz and Winzip
> will also handle it correctly.
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 00:08:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How can I use image as a submit botton ?
Message-Id: <slrn7otfgj.c9j.abigail@alexandra.delanet.com>
Yeong Mo/Director Hana co. (factory@factory.co.kr) wrote on MMCXLIII
September MCMXCIII in <URL:news:7mj526$ssu$1@news1.kornet.net>:
~~ How can I use image as a submit botton ?
Scan the image, resize it to a suitable format, print it on a sticker,
then stick it on your submit button.
Now, what has this to do with Perl?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 00:21:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: long explanations wearying (was Re: Top 10 responses)
Message-Id: <slrn7otgam.c9j.abigail@alexandra.delanet.com>
Mats Pettersson (mats.pettersson@falukuriren.se) wrote on MMCXLIV
September MCMXCIII in <URL:news:378E4DDE.D2905C11@falukuriren.se>:
::
:: Why not split perl.misc to three groups like:
::
:: perl.newbie
:: perl.professional
:: perl.cgi
Remember comp.unix.wizards. People asking stupid FAQs, or off-topic
questions will not ask them in perl.newbie, but in perl.professional.
Not only do they think they have a unique question that can only
be answered by professionals, they themselves are "professional web
designers" - a rare and elite breed of critters for which only the best
of the best is good enough.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 00:51:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: loop problems ??
Message-Id: <slrn7oti2f.c9j.abigail@alexandra.delanet.com>
stu7@usa.net (stu7@usa.net) wrote on MMCXLV September MCMXCIII in
<URL:news:7mm7e8$35q$1@nnrp1.deja.com>:
__
__
__ Ive had the same(?) problem with two short scripts... both of them
__ work alone, but when written inside a loop, either fail completely,
__ or give different output than expected.
__
__ $this = "that"; print "$this is the word" // works fine by itself
__
__ but inside an if loop, prints that (on one line), and then
__ prints everything else on a second line... still printing, but
__ why the new line ??
Really? Are you absolutely sure?
Let's try....
#!/opt/perl/bin/perl -w
use strict;
my $this = "that";
foreach (1 .. 10) {
print "$this is the word";
}
__END__
that is the wordthat is the wordthat is the wordthat is the wordthat is the wordthat is the wordthat is the wordthat is the wordthat is the wordthat is the word
Hmmm. Doesn't seem to print newlines....
Are you sure you are telling us all the facts? Or is this loop of yours
(which you carefully hide) perhaps a while that reads from a handle,
and you assign the line read to '$that', and then you print it?
If that is the case........ think what a line makes a line. How would
perl know where a line ends? Could it be..... because a line ends with
something typical? And could that typical thing perhaps be printed?
__ Is there a standard way to protect "$this" type values inside loops ?
I think you are blaming the wrong thing.
__ (btw...the other script also runs fine, but wont exit correctly when
__ a loop is included inside)
Sure. And make sure you don't tell us your code, or we might falsify you.
__ Maybe some PERL manpage discusses special treatment of print
__ statements inside loops ??
Yes. Maybe. Did you read the manual about print? Did you do a "man perlloop",
for the man page that discusses all the things that are different in a loop?
(Did you know that 'gethostbyname' in a loop actually retrieves turtles?)
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 00:56:27 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: MYSQL - Help
Message-Id: <slrn7otibd.c9j.abigail@alexandra.delanet.com>
Ian Coetzee (seccoza@mweb.co.za) wrote on MMCXLIV September MCMXCIII in
<URL:news:378defc1.0@news1.mweb.co.za>:
@@
@@ Now it pops out 10 000 replies ? How can I say to SQL to only send through
@@ the first 20 or those replies that match between 20 and 40 ?
That's not very SQL like. You're stuck in limited sequencial world.
The S in SQL stands for _Set_. Think setlike. SQL is a very powerful,
compact and cool language. But you have to open your mind.
But if you insist, I'm sure the SQL newsgroups can tell you all the tricks.
This group, however, discusses Perl. Not SQL.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 00:59:13 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Newbie needs help: Environment variables
Message-Id: <slrn7otigi.c9j.abigail@alexandra.delanet.com>
Peter Marek (pmarek@stargate-systems.com) wrote on MMCXLIII September
MCMXCIII in <URL:news:378CC37E.394D2E7C@stargate-systems.com>:
!! Hi all,
!!
!! I'm running Perl verion 5 and need to execute a bourne shell script that
!! exports some environment variables. These variables need to be visible
!! to the caller which is the Perl script. Sounds simple enough but can't
!! seem to get it to work. I've tried system(), ``, qx, fork/exec,
!! everything I could think of.
!!
!! Can anyone shed some light on this?
VMS -> install () || die "You cannot do that\n";
Of course, there's the FAQ that explains this, but the FAQ is just to
fill the holes in your hard disk, isn't?
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 16 Jul 1999 00:44:36 -0600
From: "k paul mallasch" <pmallasch@thestarpress.com>
Subject: Re: ok, DBI alt row colors - phrased better w/code
Message-Id: <Ovzj3.375$Cs3.4244778@news.netdirect.net>
Thanks, worked like a charm ;)
K. Paul Mallasch - Webmaster
http://www.thestarpress.com
----------
In article <1dv0dvh.1ihb2qh1y1jsmyN@p113.tc1.metro.ma.tiac.com>,
rjk@linguist.dartmouth.edu (Ronald J Kimball) wrote:
>
> print "<table>";
>
> $t = 0;
>
> while (@row = $sth->fetchrow_array) {
> $bgcolor = $t ? ' bgcolor="blue"' : '';
> $t ^= 1;
>
> print "<tr>";
> print "<td$bgcolor>$row[1]</td>";
> print "<td$bgcolor>$row[2]</td>";
> print "<td$bgcolor>$row[3]</td>";
> print "</tr>\n";
> }
>
> print "</table>";
------------------------------
Date: 16 Jul 1999 05:21:55 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Old database is erased when I add new information
Message-Id: <7mmfhj$ham$1@news.NERO.NET>
In article <7mm42a$l9s$0@216.39.141.200>, Neko <tgy@chocobo.org> wrote:
>You gain a good reputation by delivery a good product. You get a better
>product if you have others pointing out your mistakes.
And too many cooks spoil the broth. Too many people modifying the code
is a bad thing. Having people modifying your code when you don't even
know they are doing it does NOTHING good for your code or your
reputation.
>You shouldn't be writing X-ray machines, missile guidance systems, or dancing
>dogs in Perl. :)
I'm sorry you missed the point completely.
>No one ever said open source works for everything.
Except to do otherwise is "not the perl way" and people are ridiculed
when they ask how not to have open source.
>>And just how do I verify that my version is compatible with theirs
>>unless I study what they have done?
>
>You don't. There is absolutely no reason you must make your code compatible
>with theirs.
Fine. That's what I tell them when what they have been doing doesn't
work anymore. That's a great way to improve a reputation.
Unless you know the situation, please don't tell me what I don't have to
do.
>>>Your two users have forked off entirely different programs.
>>
>>No, not entirely different programs. Not unless you count every
>>modification to a system as an entirely new system. I don't.
>
>Yes. If two programs work differently, I count them as different.
The statement was "entirely different". If they differ in one small
operation, that's what you call "entirely different"? When you buy a new
muffler for your truck, is that an entirely new truck? Its not even a
new or different truck, much less entirely anything.
>If it's no fun, then don't merge. Save oodles of time!
If I don't merge, I have to program it. Where is this time I save by
having people send me patches?
>someone breaks your software (and calls it adding features), you do not have
>to twist your software to make it compatible.
Thanks again for not having a clue about the situation yet volunteering
to tell me what I don't have to do.
>>Except it isn't always a help. And it keeps non-programmers from hurting me.
>...
>Again, I do not see why you must make your software conform to changes that
>your users make.
Because if I don't they won't use the "latest release" and I will be
stuck helping them modify code that is even more divergent from the
current version. I suppose you will say that I will save lots of time by
doing this.
>The number of people who corrupt a binary file with FTP ASCII far outnumber
>those who ever contemplate editing a Perl program.
So what? Accidental modification of a binary is not the issue.
Deliberate modification is.
------------------------------
Date: 16 Jul 1999 05:30:22 GMT
From: Tom Burton-West <tbw@netcom13.netcom.com>
Subject: Problem with Perldoc in Perl 5.005_02
Message-Id: <7mmg1e$qcs@dfw-ixnews8.ix.netcom.com>
Is there a way to get the latest version of Perldoc without
downloading the entire perl source distribution?
The perldoc that came with my distribution is broken.
When using perldoc which came with Perl on SuSE 6.1 Linux, I get two
types of errors. Many times I get the message:
>perldoc perlfunc
mkdir /tmp/.perldoc: File exists at /usr/bin/perldoc line 352.
This seems to be caused by the following code in perldoc:
} else {
mkdir("/tmp/.perldoc",0755) || die "mkdir /tmp/.perldoc: $!";
$tmp = "/tmp/.perldoc/perldoc1.$$";
}
Near the end of the code there is the following lines
1 while unlink($tmp); #Possibly pointless VMSism
rmdir "/tmp/.perldoc";#for unix only, we i
-somehow this /tmp/.perldoc directory is not being removed
-
Is there a problem in the perldoc code?
The other problem is that when I can get perldoc to work, when I use
the -f flag, the pod pages are not formatted and I get raw pod with
stuff like =item....
Looks like the version of perldoc is missing the code to run the pod
for the function through pod2man |troff -man|$PAGER. The code excerpt
below looks like it will problperly use pod2text if the -t option is
used, but otherwise it will put the raw pod straight to the pager:
:if ($opt_f) {
....[other code skipped]
if (@pod) {
if ($opt_t) {
open(FORMATTER, "| pod2text") || die "Can't start filter";
print FORMATTER "=over 8\n\n";
print FORMATTER @pod;
print FORMATTER "=back\n";
close(FORMATTER);
} elsif (@pod < $lines-2) {
print @pod;
} else {
foreach my $pager (@pagers) {
open (PAGER, "| $pager") or next;
print PAGER @pod ;
close(PAGER) or next;
last;
}
}
} else {
die "No documentation for perl function `$opt_f' found\n";
}
tbw@netcom.com
------------------------------
Date: 16 Jul 1999 01:17:54 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regular expression
Message-Id: <x7wvw1kwal.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> In article <x7k8s1mk42.fsf@home.sysarch.com> on 15 Jul 1999 21:58:05 -
LR> 0400, Uri Guttman <uri@sysarch.com> says...
>> >>>>> "h" == h0444vcs <h0444vcs@rz.hu-berlin.de> writes:
h> Each line has different fields seperated by ":" (like /etc/passwd ).
>>
h> @array = grep { !/$name/ } @array ;
>>
h> would remove all entries in the array where $name appears.
h> But I want to ensure that only these entries are removed where
h> $name appears in a certain field of the line.
>>
>> @out = grep { (split ':')[$column] ne $name } @array ;
LR> Because the match might be in the last field, perhaps that should be:
LR> @out = grep { (split /[:\n]/)[$column] ne $name } @array ;
one could chomp first. it was not specified if the lines had a bris. :-)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Fri, 16 Jul 1999 00:33:16 -0500
From: brian@pm.org (brian d foy)
Subject: Re: using ParseWords
Message-Id: <brian-1607990033160001@44.bloominton-01rs13-14rt.il.dial-access.att.net>
[missing citation for my response]
In article <378EC6DA.C0FE678F@esn.net>, "M.A. Henderson"
<dchender@esn.net> wrote:
>> It should be:
>
>&parse_line(\, $keep, /x"[$variable]*"x/]);
>
>$keep is just boolean to remove or leave delimiters
>
>
>When I try this though, it returns a syntax error on the &parse_line
>function at the forward slash.
why do you think that is? what does a \ do? answer that question
and you've solved your first problem :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: 15 Jul 1999 21:59:33 -0700
From: Michael Kelly - FVC PCD VET ~ <kelly@pcocd2.intel.com>
Subject: Re: using slices in a hash of a hash
Message-Id: <us2oghdmbpm.fsf@fht2006.fm.intel.com>
S Starre <sstarre@my-deja.com> writes:
>
> I'm tyring to use something like:
>
> foreach (@main::names2)
>
> {@h{$_}{@main::names} = @main::thelist;
>
> and I get:
>
> Can't use subscript on hash slice at x.pl line 23, near "@main::names}"
>
> why? @h{$_}{@main::names} is a slice isn't it?
Been there...Either you think you're over writing the list
@main::names pointed to with $h{$_} by the assignment, which you would
do with $h{$_} = @main::names. Or you're trying to use each element
of the list @h{$_}{@main::names} as a key pointing to each value in
the list @main::thelist, in which case you would use 'map', which I
have never done. And if I tried to give you an untested example
Larry, would kick my butt...again.
The path to the excellent documentation is:
ftp://ftp.spu.edu/pub/CPAN/doc/manual/html/pod/perlfunc/map.html
For further reading I recomend "Advanced Perl Programming".
Chapter one has about everything you need for data structures.
--
Not speaking for Intel
Michael Kelly (the one in Folsom)
1900 Prarie City Road desk (916) 356-2822
Folsom, CA. 95630 Page (916) 360-5847
M/S FM6-114 fax (916) 356-4561
"Just say not to a pretty GUI"
------------------------------
Date: 16 Jul 1999 05:21:26 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Why we can't do this !?
Message-Id: <7mmfgm$hgv$1@lublin.zrz.tu-berlin.de>
Ryan Ngi <ryanngi@hotmail.com> wrote in comp.lang.perl.misc:
[irrelevant parts snipped throughout]
>we can do this..!
>
> local $x{foo};
>
>but we can't do this
>
> my $x{foo};
>
>Why!?
Well, my() and local() look superficially similar, but are really two
very different beasts. One of the major differences is that local()
is concerned with values, while my() creates variables. In particular,
local() hides away a value and replaces it with undef. After you leave
the current block, Perl retrieves the stashed-away value and reassigns
it. When local() is applied to a variable, the variable is the same
as before, only its value has been replaced and bears a marker that
the old value can be be reassigned at some time in the future. So
local() can be applied to values that aren't variables, such as
array slices or, as in your example, a single element of a hash.
My, on the other hand, creates a new variable, name and all. Even
when a global variable of the same name exists, it is unaffected
by my() and can still be accessed (with its previous value) through
its fully qualified name ($main::x, for example). That's why
my $x{foo} doesn't work -- $x{foo} isn't a Perl variable. To
achieve something similar, you must apply my() to the entire hash:
my %x works, but affects the whole hash, not just a single element.
Anno
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 162
*************************************