[29257] in Perl-Users-Digest
Perl-Users Digest, Issue: 501 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 10 16:10:21 2007
Date: Sun, 10 Jun 2007 13:09:06 -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 Sun, 10 Jun 2007 Volume: 11 Number: 501
Today's topics:
Re: encode UTF8 -> MIME <hjp-usenet2@hjp.at>
Please help with this code <myshipper@gmail.com>
Re: Sending RTF email with Perl? <hjp-usenet2@hjp.at>
Re: SendMail.pm: smtp and gmail <hjp-usenet2@hjp.at>
Useless use of array element in void context <mstep@podiuminternational.org>
Re: Useless use of array element in void context <hjp-usenet2@hjp.at>
Re: Useless use of array element in void context <rvtol+news@isolution.nl>
Re: Useless use of array element in void context <mritty@gmail.com>
Re: Useless use of array element in void context <mritty@gmail.com>
Re: Useless use of array element in void context <mritty@gmail.com>
Re: Useless use of array element in void context <rvtol+news@isolution.nl>
Re: Useless use of array element in void context <hjp-usenet2@hjp.at>
Re: Useless use of array element in void context <mark.clementsREMOVETHIS@wanadoo.fr>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 10 Jun 2007 12:59:14 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: encode UTF8 -> MIME
Message-Id: <slrnf6nmc2.bn7.hjp-usenet2@zeno.hjp.at>
On 2007-05-30 00:00, cc96ai <calvin.chan.cch@gmail.com> wrote:
> I got UTF8 value %C3%A9
Thats's not UTF-8. That's URL-encoded UTF-8.
> how could I encode it become é ?
You have *decode* it to get é. And since it is encoded twice, you have
to decode it twice.
First decode the URL-Encoding:
$s = "%C3%A9";
$s =~ s/%([0-9A-F][0-9A-F])/chr(hex($1))/eg;
(there is almost certainly a module on CPAN which provides a
function to do that - but (to my surprise) neither CGI nor URI
contain such a function, ans its a simple one-liner)
Now you have UTF-8, which you can decode to a "perl character string":
use Encode;
$s = decode('utf-8', $s);
Now you have a string with a single character "é".
Now, how does MIME get into it?
For MIME, you again have to decide on a specific character encoding
(e.g., UTF-8, or ISO-8859-1, or whatever), and then possibly on a
specific transport encoding (base64 or quoted-printable).
So you have to encode it in your character encoding first, and then
possibly encode the result again with the transport encoding.
Note that the MIME is a quite complex format (especially the encoding of
header fields described in RFC 2047 and RFC 2231), so I won't go into
more detail unless you tell us exactly what you need. Any advice I can
give (except "use existing modules" and "read the RFCs") is almost
certainly incomplete and will cause you to produce ill-formed messages
if follow it blindly.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Sun, 10 Jun 2007 19:59:24 -0000
From: Mr Ryerson <myshipper@gmail.com>
Subject: Please help with this code
Message-Id: <1181505564.849258.310130@m36g2000hse.googlegroups.com>
This code is in the config.pl file
$config{'verifiedmembersfile'} = 'verifiedmembers.txt';
$config{'verifiedmember_html'} = '
bgcolor="f3f3f3" style="border-bottom: 2px solid gray;">
face="Tahoma" size="2">Verified PayPal Seller
$config{'paypal1'} . '"
';
my %verifiedmembers_data = ();
open (DAT, $config{'basepath'}.$config{'verifiedmembersfile'} ) ||
die("Could not open file " .
$config{'basepath'}.$config{'verifiedmembersfile'} );
while () {
chomp;
$verifiedmembers_data{lc($_)} = 1;
}
close DAT;
$verifiedmembers_data{'mytest'} = 123;
$config{'verifiedmembers_data'} = \%verifiedmembers_data;
#########################
#And this is in my auction.pl file
my $mytitle;
if ($feat_yt eq "YES"){
print "
BGCOLOR=\"$config{'boldbackground'}\">";
}
else {
print "
BGCOLOR=\"$itemrowcolor\">";
}
if ($feat_bf eq "YES") {
$mytitle = "$title";
}
else {
$mytitle = "$title";
}
my $my_verifiedmember_html;
if
(exists(${$config{'verifiedmembers_data'}}{lc($sel leralias)}))
{
$my_verifiedmember_html =
$config{'verifiedmember_html'};
}
print
"
$filler$imagedisp";
print "$config{'displistfont'}
HREF=\"$ENV{'SCRIPT_NAME'}?category=$form{'category '}&item=$file
\" >$grabberpic $mytitle$my_verifiedmember_html";
print
"$#bids$config{'currencytype'}$bid$timerem
ai n\n";
}
}
What I need is a peice of code I can place on a particular page where
there is nothing and if they are not verified a peice of text I can
add that says this seller is not verified please help
------------------------------
Date: Sun, 10 Jun 2007 13:22:31 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Sending RTF email with Perl?
Message-Id: <slrnf6nnnn.bn7.hjp-usenet2@zeno.hjp.at>
On 2007-06-04 21:37, J.D. Baldwin <INVALID_SEE_SIG@example.com.invalid> wrote:
>
>
> I am trying to use a module to send an RTF email (because I need to
> use color codes) from Perl. I have been using MIME::Lite to send
> email attachments, but am unable to get it to send the mail itself as
> RTF.
[...]
> As noted, this works fine. If I change this to
>
> #!/usr/bin/perl -w
> use strict;
> use MIME::Lite;
[...]
> my $msg = MIME::Lite->new(
> Subject => 'TEST RTF MESSAGE',
> From => 'YOU@somewhere.com',
> To => $email,
> Type => 'text/rtf',
> Data => $rtfstring
> );
> $msg->send;
>
> ... it simply doesn't work. The "raw" RTF shows up as plain text in
> the email.
The first question is of course: Does your email client support RTF at
all? If so, do you have any RTF messages which are displayed correctly?
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Sun, 10 Jun 2007 12:38:44 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: SendMail.pm: smtp and gmail
Message-Id: <slrnf6nl5k.bn7.hjp-usenet2@zeno.hjp.at>
On 2007-05-30 10:42, Tim Southerwood <ts@dionic.net> wrote:
> Davidcollins001@gmail.com wrote:
>>> Are you sure for port? Default port for SSL is 443
443 is HTTPS, as others already noted.
>> The gmail page says that their smtp server uses ports 465 or 587,
>> neither work for me (I tried 443 and it was the same too)
>> (http://mail.google.com/support/bin/answer.py?answer=13287)
>
> 587 usually requires TLSfollowed by an SMTP AUTH, not SSL - and it certainly
> accepts an initial connection from telnet.
That's the recommended way for submitting mail.
> 465 I think is the one that you want for SSL - that is accepting connections
> too and it looks like an SSL connect.
This one is considered obsolete. Google probably still supports it for
compatibility with MS Outlook.
If you can, use port 587 + STARTTLS, not port 465.
A very nice tool for testing SMTP connections and also for sending mail,
is "swaks", the swiss army knife for smtp. It is written in perl and you
can use it on the command line to send mail, e.g., like this:
swaks -s smtp.googlemail.com -tlso -au $username -ap $password -t
$recipient -f $sender --timeout 10m
works for me (except that Gmail doesn't seem to like the "quit" command
- it just sits there and waits until swaks kills the connection)
Or you can modify it to suit your tastes.
You can get swaks from http://jetmore.org/john/code/#swaks and it is
also included in some Linux distributions (e.g., Debian). To use TLS,
you also need to install Net::SSLeay.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Sun, 10 Jun 2007 03:20:03 -0700
From: Marek <mstep@podiuminternational.org>
Subject: Useless use of array element in void context
Message-Id: <1181470803.563622.168290@g4g2000hsf.googlegroups.com>
Hello all,
as a beginner, I am not sure, why I get this message "Useless use of
array element in void context". To illustrate I made a concentrated
excerpt of my larger perl project.
I need to compare two strings, which start with a different date, than
are coming numbers, which may or may not be different, and one line
finishes with a name. Whether the numbers are different in the string,
I made a split on white space, to compare them. Is there probably a
better way to compare two strings? In any case perl syntax check is
complaining about line 41 but is running fine. Really no idea why?
Thank you in advance
marek
#! /usr/bin/perl/
use warnings;
use strict;
my @out_lines = split(
/\n/,
'Mit, 16.05.2007 992.50 44284.40 2688 69.50
10110.90 Name1
Don, 17.05.2007 1148.90 44364.80 2707 69.50
10307.60 Name2
Fre, 18.05.2007 1408.50 44496.50 2714 69.50
10512.90 Name1
Sam, 19.05.2007 1736.60 44665.00 2738 69.50
10864.50 Name2
Son, 20.05.2007 2003.41 44769.00 2746 69.50
11037.70 Name1
Mon, 21.05.2007 2294.10 44907.40 2754 70.50
11256.30 Name1
Die, 22.05.2007 2683.10 45151.10 2762 70.50
11607.90 Name1
Mit, 23.05.2007 2994.30 45284.10 2765 70.50
11808.00 Name1
Don, 24.05.2007 3092.10 45336.50 2777 70.50
11953.40 Name1
Fre, 25.05.2007 3092.10 45336.50 2777 70.50
11953.40 Name2
Sam, 26.05.2007 3092.10 45336.50 2777 70.50
11953.40 Name2
Son, 27.05.2007 3092.10 45336.50 2777 70.50
11953.40 Name2
Mon, 28.05.2007 3494.70 45498.30 2816 70.50
12358.30 Name2
Die, 29.05.2007 3896.20 45617.80 2821 70.50
12535.40 Name1
Mit, 30.05.2007 4226.30 45851.00 2829 70.50
12875.60 Name1
Don, 31.05.2007 4465.80 45920.90 2834 70.50
12974.20 Name1'
);
my $old_line;
foreach my $out_line (@out_lines) {
if ($old_line) {
$old_line =~ s/\s+[-a-z\d]+$//i;
my @old_line = split( /\s+/, $old_line );
my @out_line = split( /\s+/, $out_line );
if (
(
$old_line[2], $old_line[3], $old_line[4],
$old_line[5], $old_line[6]
) == (
$out_line[2], $out_line[3], $out_line[4],
$out_line[5], $out_line[6]
)
)
{
print "same numbers:\n";
print join("\t",@old_line) . "\n";
print join("\t",@out_line) . "\n";
print "TOTAL\t\t0.00\t0.00\t0.00\t0.00\t0.00\n";
}
else {
my $result2 = $out_line[2] - $old_line[2];
my $result3 = $out_line[3] - $old_line[3];
my $result4 = $out_line[4] - $old_line[4];
my $result5 = $out_line[5] - $old_line[5];
my $result6 = $out_line[6] - $old_line[6];
print "different numbers\n";
print join("\t",@old_line) . "\n";
print join("\t",@out_line) . "\n";
printf( "TOTAL\t\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",
$result2, $result3, $result4, $result5, $result6 );
}
$old_line = $out_line;
}
else {
$old_line = $out_line;
}
}
------------------------------
Date: Sun, 10 Jun 2007 13:42:57 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Useless use of array element in void context
Message-Id: <slrnf6nou1.bsj.hjp-usenet2@zeno.hjp.at>
On 2007-06-10 10:20, Marek <mstep@podiuminternational.org> wrote:
> as a beginner, I am not sure, why I get this message "Useless use of
> array element in void context". To illustrate I made a concentrated
> excerpt of my larger perl project.
>
> I need to compare two strings, which start with a different date, than
> are coming numbers, which may or may not be different, and one line
> finishes with a name. Whether the numbers are different in the string,
> I made a split on white space, to compare them.
You cannot compare lists with "==". If you write something like
> if (
> (
> $old_line[2], $old_line[3], $old_line[4],
> $old_line[5], $old_line[6]
> ) == (
> $out_line[2], $out_line[3], $out_line[4],
> $out_line[5], $out_line[6]
> )
> )
the commas are interpreted as the comma operator, so it means something
like:
evaluate $old_line[2] and throw the value away, then
evaluate $old_line[3] and throw the value away, then
evaluate $old_line[4] and throw the value away, then
evaluate $old_line[5] and throw the value away, then
evaluate $old_line[6] and keep it,
evaluate $out_line[2] and throw the value away, then
evaluate $out_line[3] and throw the value away, then
evaluate $out_line[4] and throw the value away, then
evaluate $out_line[5] and throw the value away, then
evaluate $out_line[6] and keep it
if the two values we kept ($old_line[6] and $out_line[6] are
numerically equal ...
Or in other words, since there are no side effects, its exactly the same
as if you had written
if ($old_line[6] == $out_line[6])
Perl is warning you that this is probably not what you wanted.
What you probably wanted is to compare each field individually:
if ($old_line[2] == $out_line[2]
&& $old_line[3] == $out_line[3]
&& $old_line[4] == $out_line[4]
&& $old_line[5] == $out_line[5]
&& $old_line[6] == $out_line[6])
or in a loop:
my $same = 1;
$same = $same && $old_line[$_] == $out_line[$_] for (2 .. 6);
if ($same)
> Is there probably a better way to compare two strings? In any case
> perl syntax check is
This is not a syntax check. The syntax is fine. It is the semantic of
the code which is probably wrong.
> complaining about line 41 but is running fine.
Define "running fine". Are the results correct?
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Sun, 10 Jun 2007 13:50:58 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Useless use of array element in void context
Message-Id: <f4gvri.140.1@news.isolution.nl>
Marek schreef:
> if (
> (
> $old_line[2], $old_line[3], $old_line[4],
> $old_line[5], $old_line[6]
> ) == (
> $out_line[2], $out_line[3], $out_line[4],
> $out_line[5], $out_line[6]
> )
> )
This doesn't do what you expect it to. Test with
perl -wle 'print( (1,2,0) == (5,4,0) ? "A" : "B")'
Maybe use:
if ( join ( "\n", @old_line[2..6] ) eq
join ( "\n", @out_line[2..6] )
) {
...
}
but consider List::Util.
> my $result2 = $out_line[2] - $old_line[2];
> my $result3 = $out_line[3] - $old_line[3];
> my $result4 = $out_line[4] - $old_line[4];
> my $result5 = $out_line[5] - $old_line[5];
> my $result6 = $out_line[6] - $old_line[6];
Alternative-1:
$result[$_] = $out_line[$_] - $old_line[$_] for 2..6;
Alternative-2:
@result = map $out_line[$_] - $old_line[$_], 2..6;
> printf( "TOTAL\t\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",
> $result2, $result3, $result4, $result5, $result6 );
printf ( "TOTAL\t\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",
@result [2..6] );
or even:
my $s;
$s .= sprintf ( "\t%.2f", $out_line[$_] - $old_line[$_] )
for 2..6;
print "TOTAL\t", $s, "\n";
or evener:
my @s = '', map sprintf ( "%.2f", $out_line[$_] - $old_line[$_] ),
2..6;
print do { local $" = "\t"; "TOTAL$\"@s\n" };
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sun, 10 Jun 2007 05:01:04 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Useless use of array element in void context
Message-Id: <1181476864.381879.63980@n4g2000hsb.googlegroups.com>
On Jun 10, 6:20 am, Marek <m...@podiuminternational.org> wrote:
> as a beginner, I am not sure, why I get this message "Useless use
> of array element in void context". To illustrate I made a
> concentrated excerpt of my larger perl project.
Excellent! Well done! Seriously, that's one of the best things I've
read in this newsgroup in a long time.
> #! /usr/bin/perl/
>
> use warnings;
> use strict;
More excellencence!!
> if (
> (
> $old_line[2], $old_line[3], $old_line[4],
> $old_line[5], $old_line[6]
> ) == (
> $out_line[2], $out_line[3], $out_line[4],
> $out_line[5], $out_line[6]
> )
> )
> {
This is the problem. This block does not do what you think it does.
The == operator in Perl does not compare lists. It only compares
scalars. Therefore, both of the "lists" are being evaluated in scalar
context[1], and so it's only comparing the last element of each list.
That is, the above block is identical to:
if ($old_line[6] == $out_line[6])
None of the other elements are being looked at by the == operator.
That's why Perl is telling you all those array elements are being
uselessly used in a void context.
If you want to compare two arrays for equality of their elements, you
have a few possibilities. You could modify the example in the FAQ to
suit your needs. (From a command line, run `perldoc -q equal`), or you
could use either of the modules Array::Compare or List::Compare from
the CPAN (head to http://search.cpan.org and search for those
modules).
Note there are also less robust solutions involving comparing the two
arrays as strings - for example:
if ("@a1" eq "@a2")
or
use Data::Dumper;
if (Dumper(\@a1) eq Dumper(\@a2) )
But these are generally dangerous because they could return false
positives. For example, the first one would report that these two
arrays are indeed equal:
my @a1 = (1, 2, 3);
my @a2 = ("1 2", 3);
The Dumper one is more unlikely to give false positives, but still
possible.
My overall suggestion would be to modify the example given in the FAQ
to suit your needs.
Good luck!
Paul Lalli
------------------------------
Date: Sun, 10 Jun 2007 05:06:13 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Useless use of array element in void context
Message-Id: <1181477173.116615.109550@k79g2000hse.googlegroups.com>
On Jun 10, 8:01 am, Paul Lalli <mri...@gmail.com> wrote:
> The == operator in Perl does not compare lists. It only compares
> scalars. Therefore, both of the "lists" are being evaluated in
> scalar context[1]
Whoops, forgot my footnote. I meant to include the point that when
code looks as though a list is being used in a scalar context, what's
actually happening is that the comma operator is being used in scalar
context. The comma operator in scalar context does not create a list
- instead it evaluates its left argument, throws it away, and then
evaluates its right argument, and returns it.
my $x = (f1(), f2());
That statement calls the subroutine f1(), ignores its return value,
then calls f2() and puts f2's return value in $x.
So when you get a bunch of comma operators used in sequence like:
my $x = (1, 2, 3, 4, 5);
each comma operator evaluates its left argument, and then throws the
value away. The last element in the sequence (in this case, 5) is
returned from the expression. That's why
if ( (1, 2, 3) == (4, 5, 6) )
is only checking if 3 is equal to 6, and not any of the others.
Paul Lalli
------------------------------
Date: Sun, 10 Jun 2007 05:11:07 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Useless use of array element in void context
Message-Id: <1181477467.023997.237440@m36g2000hse.googlegroups.com>
On Jun 10, 7:50 am, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
> Marek schreef:
>
> > if (
> > (
> > $old_line[2], $old_line[3], $old_line[4],
> > $old_line[5], $old_line[6]
> > ) == (
> > $out_line[2], $out_line[3], $out_line[4],
> > $out_line[5], $out_line[6]
> > )
> > )
>
> This doesn't do what you expect it to. Test with
>
> perl -wle 'print( (1,2,0) == (5,4,0) ? "A" : "B")'
>
> Maybe use:
>
> if ( join ( "\n", @old_line[2..6] ) eq
> join ( "\n", @out_line[2..6] )
> ) {
> ...
> }
So long as you're aware of the possibility of false positives, like:
my @a1 = (1, 2, 3);
my @a2 = ("1\n2", 3);
If that's not possible for your data, then by all means, go for it.
> but consider List::Util.
Can you explain which of List::Util's subroutines you believe will be
useful for comparing two lists for equality? Maybe reduce(), but if
so, I can't figure it out...
Thanks,
Paul Lalli
------------------------------
Date: Sun, 10 Jun 2007 17:50:16 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Useless use of array element in void context
Message-Id: <f4hdtr.90.1@news.isolution.nl>
Paul Lalli schreef:
> Dr.Ruud:
>> if ( join ( "\n", @old_line[2..6] ) eq
>> join ( "\n", @out_line[2..6] ) ) {
>
> So long as you're aware of the possibility of false positives, like:
> my @a1 = (1, 2, 3);
> my @a2 = ("1\n2", 3);
> If that's not possible for your data, then by all means, go for it.
Because the data was split on whitespace, as it often is, the
"technique" is possible.
It might remind some people of hoops they needed to go through when
using sed.
I don't tolerate such code in production, for the reason that you
mentioned, and for the data conversion (list values concatenated in a
string).
>> but consider List::Util.
>
> Can you explain which of List::Util's subroutines you believe will be
> useful for comparing two lists for equality? Maybe reduce(), but if
> so, I can't figure it out...
I now checked List::MoreUtils as well, and even that doesn't have the
compare functionality that I expected. I must have seen it someweher
else, Bit::Vector maybe.
Though List::MoreUtils::pairwise can be used. But no list_is() or
list_eq() in either. Even a list_diff() would do.
Some other approaches:
if (5 == grep $_, map $old_line[$_] == $out_line[$_], 2..6) {
(but that needs two changes if the length of the range is changed)
my $same = 1; $same &&= $old_line[$_] == $out_line[$_] for 2..6;
(almost as hp showed)
unless (grep $_, map $old_line[$_] != $out_line[$_], 2..6) {
(ok, but not shortcutting)
my $diff; $diff ||= $old_line[$_] != $out_line[$_] and last for 2..6;
(shortcuts)
An (alpha) firstidx_diff for List::MoreUtils:
(beware, this one does numeric equation only)
#!/usr/bin/perl
use strict;
use warnings;
sub firstidx_diff (\@\@;@) {
$_[0]->[$_] != $_[1]->[$_] and return $_
for $_[2] ? @_[2..$#_] : $[..$#{$_[0]};
return '==';
}
my @x = (0..6, 70..99);
my @y = (0..6, 80..99);
print firstidx_diff( @x, @y ), "\n"; # 7
my @x1 = @x[2..6];
my @y1 = @y[2..6];
print firstidx_diff( @x1, @y1 ), "\n"; # ==
print firstidx_diff( @x, @y, 2..6 ), "\n"; # ==
my @z = (9, 9, 2..6, 90..99);
print firstidx_diff( @x, @z ), "\n"; # 0
print firstidx_diff( @x, @z, 2..10 ), "\n"; # 7
__END__
P.S. Perl6::Junction?
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sun, 10 Jun 2007 18:56:18 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Useless use of array element in void context
Message-Id: <slrnf6ob9i.cbo.hjp-usenet2@zeno.hjp.at>
On 2007-06-10 15:50, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> Paul Lalli schreef:
>> Dr.Ruud:
>>> but consider List::Util.
>>
>> Can you explain which of List::Util's subroutines you believe will be
>> useful for comparing two lists for equality? Maybe reduce(), but if
>> so, I can't figure it out...
>
> I now checked List::MoreUtils as well, and even that doesn't have the
> compare functionality that I expected. I must have seen it someweher
> else, Bit::Vector maybe.
Test::More has is_deeply(). Maybe you were thinking of that.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Sun, 10 Jun 2007 19:16:52 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: Useless use of array element in void context
Message-Id: <466c3204$0$27409$ba4acef3@news.orange.fr>
Peter J. Holzer wrote:
> On 2007-06-10 15:50, Dr.Ruud <rvtol+news@isolution.nl> wrote:
>> Paul Lalli schreef:
>>> Dr.Ruud:
>>>> but consider List::Util.
>>> Can you explain which of List::Util's subroutines you believe will be
>>> useful for comparing two lists for equality? Maybe reduce(), but if
>>> so, I can't figure it out...
>> I now checked List::MoreUtils as well, and even that doesn't have the
>> compare functionality that I expected. I must have seen it someweher
>> else, Bit::Vector maybe.
>
> Test::More has is_deeply(). Maybe you were thinking of that.
I've used Set::Array in the past for such comparisons, but YMMV :)
Mark
------------------------------
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 501
**************************************