[28898] in Perl-Users-Digest
Perl-Users Digest, Issue: 142 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 15 18:10:15 2007
Date: Thu, 15 Feb 2007 15: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 Thu, 15 Feb 2007 Volume: 11 Number: 142
Today's topics:
Environment variables in Excel started from Win32::OLE nicholastoze@gmail.com
How to extract .tar files in different directory? <whdanj@gmail.com>
Re: How to extract .tar files in different directory? <marora@gmail.com>
Re: How to extract .tar files in different directory? <greg.ferguson@icrossing.com>
obfuscated <john.swilting@wanadoo.fr>
Re: obfuscated <john.swilting@wanadoo.fr>
Re: obfuscated <john.swilting@wanadoo.fr>
Re: obfuscated <john.swilting@wanadoo.fr>
Re: obfuscated <uri@stemsystems.com>
Re: obfuscated <john.swilting@wanadoo.fr>
OT: Re: obfuscated mangled translated and tangled <RedGrittyBrick@SpamWeary.foo>
PDL - Errors in PDL::Gaussian, maybe install? <keflavich@gmail.com>
Re: problem CGI <zen13097@zen.co.uk>
Re: problem CGI <bik.mido@tiscalinet.it>
Re: Regexp for email addresses. <cmic@caramail.com>
Re: script for http request <greg.ferguson@icrossing.com>
Re: Sending a local attachment via email form <john.swilting@wanadoo.fr>
Re: Sending a local attachment via email form <edMbj@aes-intl.com>
Sorting exponential numbers <fabrice.baro@gmail.com>
Re: Sorting exponential numbers <attn.steven.kuo@gmail.com>
Re: Sorting exponential numbers <fabrice.baro@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Feb 2007 11:32:53 -0800
From: nicholastoze@gmail.com
Subject: Environment variables in Excel started from Win32::OLE
Message-Id: <1171567973.842318.299480@v45g2000cwv.googlegroups.com>
Hi,
The following code only outputs 5 environment variables, not all of
the ones I can see from perl -le 'print "$_=$ENV{$_}" for keys %ENV'.
Is there a way to get all the environment variables in the VBA? I need
them so that an xll can find its license key file.
Thanks,
Nick
perl -v
This is perl, v5.8.7 built for cygwin-thread-multi-64int
uname -a
CYGWIN_NT-5.1 PC24 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
Perl script:
#!/usr/bin/perl
use strict;
use Win32::OLE;
my $ex = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;});
$ex->Workbooks->Open("C:\\test.xls", 0, 1);
$ex->Run("printenv");
VBA in Excel file "C:\test.xls":
Option Explicit
Public Sub printenv()
Dim i As Long
Open "C:\excelenv.txt" For Output As #1
i = 1
Do While Environ(i) <> ""
Print #1, Environ(i)
i = i + 1
Loop
Close #1
End Sub
------------------------------
Date: 15 Feb 2007 13:16:43 -0800
From: "Dan" <whdanj@gmail.com>
Subject: How to extract .tar files in different directory?
Message-Id: <1171574203.191768.318000@q2g2000cwa.googlegroups.com>
Hi, could anyone tell me how to do a perl script, which can
extract .tar files in
different directories?
e.g.
I have ./data/11/aaa/1a.tar, 1b.tar, 1c.tar
./data/22/bbb/2a.tar, 2b.tar, 2c.tar
how can I extract 1*.tar and 2*.tar files under /data directory into a
specified folder.
Since I am pretty new to perl, I dont know how to examine every sub-
directory
in the ./data, if there are any .tar files, then unzip it.
could you give me any examples.
Thanks a lot!
------------------------------
Date: 15 Feb 2007 13:29:50 -0800
From: "marora@gmail.com" <marora@gmail.com>
Subject: Re: How to extract .tar files in different directory?
Message-Id: <1171574990.735153.208090@j27g2000cwj.googlegroups.com>
On Feb 15, 4:16 pm, "Dan" <whd...@gmail.com> wrote:
> Hi, could anyone tell me how to do a perl script, which can
> extract .tar files in
> different directories?
>
> e.g.
>
> I have ./data/11/aaa/1a.tar, 1b.tar, 1c.tar
> ./data/22/bbb/2a.tar, 2b.tar, 2c.tar
>
> how can I extract 1*.tar and 2*.tar files under /data directory into a
> specified folder.
>
> Since I am pretty new to perl, I dont know how to examine every sub-
> directory
> in the ./data, if there are any .tar files, then unzip it.
> could you give me any examples.
>
> Thanks a lot!
You can use File::Find to traverse a directory tree. http://
perldoc.perl.org/File/Find.html
>From perl you can execute any unix command using system("cmd").
Regards,
Manish
------------------------------
Date: 15 Feb 2007 14:37:38 -0800
From: "gf" <greg.ferguson@icrossing.com>
Subject: Re: How to extract .tar files in different directory?
Message-Id: <1171579058.455051.149190@v45g2000cwv.googlegroups.com>
On Feb 15, 2:16 pm, "Dan" <whd...@gmail.com> wrote:
> Hi, could anyone tell me how to do a perl script, which can
> extract .tar files in
> different directories?
>
> e.g.
>
> I have ./data/11/aaa/1a.tar, 1b.tar, 1c.tar
> ./data/22/bbb/2a.tar, 2b.tar, 2c.tar
>
> how can I extract 1*.tar and 2*.tar files under /data directory into a
> specified folder.
>
> Since I am pretty new to perl, I dont know how to examine every sub-
> directory
> in the ./data, if there are any .tar files, then unzip it.
> could you give me any examples.
>
> Thanks a lot!
Something to consider...
Rather than do it purely in Perl, you might want to wrap a tar command
in backticks or a system() command and let the tar application handle
the problem. In that case just read up on the tar docs.
Sometimes it's easier to take advantage of Perl's ability to act as
glue, but we forget to do it when we're wearing our Perl colored
glasses.
------------------------------
Date: Thu, 15 Feb 2007 21:01:45 +0100
From: "john.swilting" <john.swilting@wanadoo.fr>
Subject: obfuscated
Message-Id: <45d4bc1c$0$27392$ba4acef3@news.orange.fr>
> perl -el { { slurp(<$lwp = HTTP::Request->new(GET=> 'file:/etc/passwd');;>
print $_);redo;};};
------------------------------
Date: Thu, 15 Feb 2007 21:03:01 +0100
From: "john.swilting" <john.swilting@wanadoo.fr>
Subject: Re: obfuscated
Message-Id: <45d4bc69$0$25937$ba4acef3@news.orange.fr>
john.swilting wrote:
>> perl -el { { slurp(<$lwp = HTTP::Request->new(GET=>
>> 'file:/etc/passwd');;>
> print $_);redo;};};
:-[
------------------------------
Date: Thu, 15 Feb 2007 21:19:26 +0100
From: "john.swilting" <john.swilting@wanadoo.fr>
Subject: Re: obfuscated
Message-Id: <45d4c042$0$25946$ba4acef3@news.orange.fr>
john.swilting wrote:
> john.swilting wrote:
>
>>> perl -el { { slurp(<$lwp = HTTP::Request->new(GET=>
>>> 'file:/etc/passwd');;>
>> print $_);redo;};};
> :-[
it is very small I do not have tries to make it go but when think
------------------------------
Date: Thu, 15 Feb 2007 21:27:16 +0100
From: "john.swilting" <john.swilting@wanadoo.fr>
Subject: Re: obfuscated
Message-Id: <45d4c218$0$27393$ba4acef3@news.orange.fr>
john.swilting wrote:
> john.swilting wrote:
>
>> john.swilting wrote:
>>
>>>> perl -el { { slurp(<$lwp = HTTP::Request->new(GET=>
>>>> 'file:/etc/passwd');;>
>>> print $_);redo;};};
>> :-[
> it is very small I do not have tries to make it go but when think
I have to test it does not walk but in 2000 it is odd Perl of the times
------------------------------
Date: Thu, 15 Feb 2007 15:40:57 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: obfuscated
Message-Id: <x7hctni27a.fsf@mail.sysarch.com>
>>>>> "js" == john swilting <john.swilting@wanadoo.fr> writes:
js> john.swilting wrote:
>> john.swilting wrote:
>>
>>> john.swilting wrote:
>>>
>>>>> perl -el { { slurp(<$lwp = HTTP::Request->new(GET=>
>>>>> 'file:/etc/passwd');;>
>>>> print $_);redo;};};
>>> :-[
>> it is very small I do not have tries to make it go but when think
js> I have to test it does not walk but in 2000 it is odd Perl of the times
you can keep talking to yourself and i am sure it will help a lot.
why are you using LWP to read a LOCAL file? i am not even sure it is
supported and even if it would work it is dumb. where did slurp come
from? no modules were used there. what is the < before $lwp mean? why
would you slurp something which has already been read in by LWP?
that is a shell command but what are the {} doing? what part of that
line is being passed to perl? why is there a loop to get a single file?
why do you need to read a file from the command line? why would you want
to read /etc/passwd?
that code makes as much sense as your comments to yourself make.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 15 Feb 2007 21:54:47 +0100
From: "john.swilting" <john.swilting@wanadoo.fr>
Subject: Re: obfuscated
Message-Id: <45d4c88b$0$25946$ba4acef3@news.orange.fr>
Uri Guttman wrote:
>>>>>> "js" == john swilting <john.swilting@wanadoo.fr> writes:
>
> js> john.swilting wrote:
> >> john.swilting wrote:
> >>
> >>> john.swilting wrote:
> >>>
> >>>>> perl -el { { slurp(<$lwp = HTTP::Request->new(GET=>
> >>>>> 'file:/etc/passwd');;>
> >>>> print $_);redo;};};
> >>> :-[
> >> it is very small I do not have tries to make it go but when think
> js> I have to test it does not walk but in 2000 it is odd Perl of the
> times
>
> you can keep talking to yourself and i am sure it will help a lot.
>
> why are you using LWP to read a LOCAL file? i am not even sure it is
> supported and even if it would work it is dumb. where did slurp come
> from? no modules were used there. what is the < before $lwp mean? why
> would you slurp something which has already been read in by LWP?
> that is a shell command but what are the {} doing? what part of that
> line is being passed to perl? why is there a loop to get a single file?
> why do you need to read a file from the command line? why would you want
> to read /etc/passwd?
>
> that code makes as much sense as your comments to yourself make.
>
> uri
>
i am :-[
------------------------------
Date: Thu, 15 Feb 2007 21:42:06 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: OT: Re: obfuscated mangled translated and tangled
Message-Id: <VtednXsfr44wTknYnZ2dnUVZ8v-dnZ2d@bt.com>
john.swilting wrote:
> john.swilting wrote:
>> john.swilting wrote:
>>> ;};};
>> :-[
> it is very small I do not have tries to make it go but when think
Isn't that sort of comment usually followed by an advert for Viagra or
cheap stock?
Cette sorte de commentaire habituellement suivie d'une annonce
n'est-elle pas pour Viagra ou les actions bon marché ?
Isn't this kind of comment usually followed by an advertisement for
Viagra or the cheap actions?
http://en.wikipedia.org/wiki/Bayesian_poisoning.
http://en.wikipedia.org/wiki/Round-trip_translation.
------------------------------
Date: 15 Feb 2007 12:03:33 -0800
From: "Keflavich" <keflavich@gmail.com>
Subject: PDL - Errors in PDL::Gaussian, maybe install?
Message-Id: <1171569813.505322.194000@m58g2000cwm.googlegroups.com>
When I try something like this:
my $gauss=new PDL::Gaussian([2],[1]);
my $covar=$gauss->get_covariance();
$covar->slice('0,0')++;
$gauss->upd_covariance();
in either a script or the perldl terminal, I get errors:
Use of inherited AUTOLOAD for non-method PDL::Primitive::sumover() is
deprecated at /usr/lib/perl5/PDL/Gaussian.pm line 221.
Can't locate auto/PDL/Primitive/sumover.al in @INC (@INC contains: /
etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/
lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/
local/lib/site_perl .) at /usr/lib/perl5/PDL/Gaussian.pm line 221
sumover.al doesn't exist on my computer/in my include directories,
though CPAN claims that my PDL installation is up to date. Can anyone
help me figure out what's wrong?
Also, is there any forum to discuss PDL specific issues? Is there any
way to enable "up-key" functionality as in bash to recall the previous
command at the perldl command line? Use the left arrow to go back in
the command?
Thanks,
Adam
------------------------------
Date: 15 Feb 2007 22:14:17 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: problem CGI
Message-Id: <45d4db39$0$2462$db0fefd9@news.zen.co.uk>
john.swilting <john.swilting@wanadoo.fr> wrote:
> #!/usr/bin/perl -w
> use strict;
> use diagnostics;
> use CGI qw/:standard escapeHTML/;
> use Data::Dumper;
>
> my $cgi = new CGI;
>
> my $one = $cgi->param('commander1');
> ##my $two = $cgi->param('commander2');
> my $dumper1 = print Dumper $one;
I don't know what you're trying to do, but that is probably wrong.
print will usually return 1, so $dumper1 will have the value 1.
Perhaps you mean:
my $dumper1 = Dumper $one
?
> ##my $dumper2 = print Dumper $two;
> sub AFFICHAGE{
It is usual to use lower case (or mixed upper/lower case) for
subroutine names. ALL CAPS usually indicates a 'special' sub, such as
AUTOLOAD, or DESTROY.
So make that:
sub affichage {
> my($one) = @_;
You do not use $one anywhere in this subroutine.
> print header();
> print start_html("Dumper");
>
> print p("fileinfo",tt(escapeHTML($dumper1)));
>
> ## print p("fileinfo",tt(escapeHTML($dumper2)));
> print end_html();
> }
>
> AFFICHAGE($one);
> perl /var/www/cgi-bin/ventedumper ? commander1=1
> it always answer me the same thing with different values with the param
------------------------------
Date: Thu, 15 Feb 2007 23:34:44 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: problem CGI
Message-Id: <hnn9t29h3pjbd0i9vr69rvrdqavffhfjs4@4ax.com>
On Thu, 15 Feb 2007 16:16:05 +0100, "john.swilting"
<john.swilting@wanadoo.fr> wrote:
>my $cgi = new CGI;
>
>my $one = $cgi->param('commander1');
>##my $two = $cgi->param('commander2');
>my $dumper1 = print Dumper $one;
perl -le 'print print 0'
>##my $dumper2 = print Dumper $two;
>sub AFFICHAGE{
All uppercase subs are "reserved" for special means.
> my($one) = @_;
You pass *this* $one, which is good...
> print p("fileinfo",tt(escapeHTML($dumper1)));
...but you print() info got from the "outer" $one, which is poor.
>perl /var/www/cgi-bin/ventedumper ? commander1=1
>it always answer me the same thing with different values with the param
Not really, I bet you also get "spurious" output which tracks the
"right" value of the param, a consequence of the first print().
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 15 Feb 2007 14:42:59 -0800
From: "cmic" <cmic@caramail.com>
Subject: Re: Regexp for email addresses.
Message-Id: <1171579379.110397.135680@v33g2000cwv.googlegroups.com>
Hello
On 14 f=E9v, 22:55, Abigail <abig...@abigail.be> wrote:
> use 5.9.5; # In fact, you need the newest blead.
>
.=2E.skipped
> --
> perl -wlpe '}{$_=3D$.}{' file # Count the number of lines.
^^^^^^^^^^^^^
As a Perl beginner, i'm a bit surprised to see this working. Could you
explain why (and how) these "counter-intuitive" } and { works ? And
how come you found out this trick ? Very very curious about this.
TIA
--
Michel Marcon, SysAdmin & Perl learner
------------------------------
Date: 15 Feb 2007 14:39:48 -0800
From: "gf" <greg.ferguson@icrossing.com>
Subject: Re: script for http request
Message-Id: <1171579188.627262.131490@p10g2000cwp.googlegroups.com>
On Feb 15, 10:56 am, Brian Wakem <n...@email.com> wrote:
> Minus the headers.
Correct, but sometimes that's desirable.
------------------------------
Date: Thu, 15 Feb 2007 20:10:21 +0100
From: "john.swilting" <john.swilting@wanadoo.fr>
Subject: Re: Sending a local attachment via email form
Message-Id: <45d4b011$0$25917$ba4acef3@news.orange.fr>
Ed Jay wrote:
> Todd scribed:
>
>>Ed Jay wrote:
>>> I know how to send an attachment that I create with a server-side email
>>> routine (MIME::Lite). It requires me to have the attachment in a known
>>> location on my host server.
>>>
>>> Can anyone provide a hint regarding a site visitor sending a local
>>> attachment using a Perl script fed with an HTML email form?
>>
>>When they upload the file you know where it is on your server.
>>
> Thanks, Todd. I'm a newbie at Perl, but somewhat adept at javascript,
> where we can't tamper with the user's files. Uploading never occurred to
> me.
#!/usr/bin/perl -w
use strict;
use diagnostics;
use CGI qw/:standard escapeHTML/;
use constant LONGUEUR_MAX => 5_000;
use CGI::Carp qw(fatalsToBrowser);
use CGI::UploadEasy;
use MIME::Lite;
use Data::Dumper;
my $ue = CGI::UploadEasy->new(-uploaddir => '/var/www/html/upload',
-tempdir => '/var/www/html/upload',
-maxsize => LONGUEUR_MAX);
my $cgi = new CGI;
my $nom = $cgi->param('nom');
my $prenom = $cgi->param('prenom');
my $mail = $cgi->param('mail');
my $attachement = $cgi->param('attachement');
my $body = $cgi->param('body');
$cgi = $ue->cgiobject;
my $info = $attachement;
$info = $ue->fileinfo;
my $from_adress = "swilting\@localhost.localdomain";
sub AFFICHAGE_ERREUR_ATTACHEMENT{
my($attachement,$info,$nom,$prenom,$mail,$body) = @_;
print header();
print start_html("erreur");
print p("erreur avec la piece jointe");
print p("");
print p("erreur",tt(escapeHTML($attachement)));
my $dumper = print Dumper $info;
print p("fileinfo",tt(escapeHTML($dumper)));
print end_html();
}
sub MAIL{
my($attachement,$info,$nom,$prenom,$mail,$body) = @_;
SEND_MAIL($attachement,$nom,$prenom,$mail,$body);
print header();
print start_html("mail");
print p("envoie du mail");
print p("avec comme piece jointe",tt(escapeHTML($attachement)));
print p("nom",tt(escapeHTML($nom)));
print p("prenom",tt(escapeHTML($prenom)));
print p("mail",tt(escapeHTML($mail)));
print p("body",tt(escapeHTML($body)));
my $dumper = print Dumper $info;
print p("fileinfo",tt(escapeHTML($dumper)));
print end_html();
}
sub SEND_MAIL{
my($attachement,$nom,$prenom,$mail,$body) = @_;
my $message_body .= $nom;
$message_body .= "\n";
$message_body .= $prenom;
$message_body .= "\n";
$message_body .= $body;
my $mime_msg = MIME::Lite->new(
From => $from_adress,
To => $mail,
Subject => 'contact',
Type => 'TEXT',
Data => $message_body,
) or die "error creating MIME body: $!\n";
if( $attachement eq ''){
$mime_msg->send;
}else{
my $attachement_upload = '/var/www/html/upload/';
$attachement_upload .= $attachement;
$mime_msg->attach(
Type => 'image/gif',
Path => $attachement_upload,
Filename => 'attachement.gif'
) or die "error attaching image: $!\n";
$mime_msg->send;
}
}
if( substr($attachement, -4) eq q/.gif/ ){
MAIL($attachement,$info,$nom,$prenom,$mail,$body);
}elsif( substr($attachement, -4) eq q/.GIF/ ){
MAIL($attachement,$info,$nom,$prenom,$mail,$body);
}elsif($attachement eq undef){
MAIL($attachement,$info,$nom,$prenom,$mail,$body);
}else{
AFFICHAGE_ERREUR_ATTACHEMENT($attachement,$info,$nom,$prenom,$mail
$body);
}
its my code
JAPH
------------------------------
Date: Thu, 15 Feb 2007 12:39:27 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Sending a local attachment via email form
Message-Id: <t6h9t2pe1s1p24tbk7765n4uql3gqnkdvu@4ax.com>
john.swilting scribed:
>Ed Jay wrote:
>
>> Todd scribed:
>>
>>>Ed Jay wrote:
>>>> I know how to send an attachment that I create with a server-side email
>>>> routine (MIME::Lite). It requires me to have the attachment in a known
>>>> location on my host server.
>>>>
>>>> Can anyone provide a hint regarding a site visitor sending a local
>>>> attachment using a Perl script fed with an HTML email form?
>>>
>>>When they upload the file you know where it is on your server.
>>>
>> Thanks, Todd. I'm a newbie at Perl, but somewhat adept at javascript,
>> where we can't tamper with the user's files. Uploading never occurred to
>> me.
>#!/usr/bin/perl -w
>
>use strict;
>use diagnostics;
>use CGI qw/:standard escapeHTML/;
>use constant LONGUEUR_MAX => 5_000;
>use CGI::Carp qw(fatalsToBrowser);
>use CGI::UploadEasy;
>use MIME::Lite;
>use Data::Dumper;
>
>my $ue = CGI::UploadEasy->new(-uploaddir => '/var/www/html/upload',
> -tempdir => '/var/www/html/upload',
> -maxsize => LONGUEUR_MAX);
>my $cgi = new CGI;
>
>my $nom = $cgi->param('nom');
>my $prenom = $cgi->param('prenom');
>my $mail = $cgi->param('mail');
>my $attachement = $cgi->param('attachement');
>my $body = $cgi->param('body');
>
>$cgi = $ue->cgiobject;
>my $info = $attachement;
>$info = $ue->fileinfo;
>
>my $from_adress = "swilting\@localhost.localdomain";
>
>sub AFFICHAGE_ERREUR_ATTACHEMENT{
> my($attachement,$info,$nom,$prenom,$mail,$body) = @_;
> print header();
> print start_html("erreur");
> print p("erreur avec la piece jointe");
> print p("");
> print p("erreur",tt(escapeHTML($attachement)));
> my $dumper = print Dumper $info;
> print p("fileinfo",tt(escapeHTML($dumper)));
> print end_html();
> }
>
>sub MAIL{
> my($attachement,$info,$nom,$prenom,$mail,$body) = @_;
> SEND_MAIL($attachement,$nom,$prenom,$mail,$body);
> print header();
> print start_html("mail");
> print p("envoie du mail");
> print p("avec comme piece jointe",tt(escapeHTML($attachement)));
> print p("nom",tt(escapeHTML($nom)));
> print p("prenom",tt(escapeHTML($prenom)));
> print p("mail",tt(escapeHTML($mail)));
> print p("body",tt(escapeHTML($body)));
> my $dumper = print Dumper $info;
> print p("fileinfo",tt(escapeHTML($dumper)));
> print end_html();
>}
>sub SEND_MAIL{
> my($attachement,$nom,$prenom,$mail,$body) = @_;
>
> my $message_body .= $nom;
> $message_body .= "\n";
> $message_body .= $prenom;
> $message_body .= "\n";
> $message_body .= $body;
>
> my $mime_msg = MIME::Lite->new(
> From => $from_adress,
> To => $mail,
> Subject => 'contact',
> Type => 'TEXT',
> Data => $message_body,
> ) or die "error creating MIME body: $!\n";
> if( $attachement eq ''){
> $mime_msg->send;
> }else{
> my $attachement_upload = '/var/www/html/upload/';
> $attachement_upload .= $attachement;
> $mime_msg->attach(
> Type => 'image/gif',
> Path => $attachement_upload,
> Filename => 'attachement.gif'
> ) or die "error attaching image: $!\n";
> $mime_msg->send;
> }
>}
>if( substr($attachement, -4) eq q/.gif/ ){
> MAIL($attachement,$info,$nom,$prenom,$mail,$body);
> }elsif( substr($attachement, -4) eq q/.GIF/ ){
> MAIL($attachement,$info,$nom,$prenom,$mail,$body);
> }elsif($attachement eq undef){
> MAIL($attachement,$info,$nom,$prenom,$mail,$body);
> }else{
> AFFICHAGE_ERREUR_ATTACHEMENT($attachement,$info,$nom,$prenom,$mail
>$body);
> }
>
>its my code
>JAPH
John, je ne sais pas vous remercier assez. Ma visite prochaine en France, je
vous achèterai le dîner! Merci beaucoup.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: 15 Feb 2007 12:05:29 -0800
From: "Fabrice Baro" <fabrice.baro@gmail.com>
Subject: Sorting exponential numbers
Message-Id: <1171569929.125202.21200@s48g2000cws.googlegroups.com>
I'm trying to sort a hash whose values are exponential numbers.
foreach my $file (sort values %{$files{$brh}}){
print "$file\n";
}
prints:
0
1e-101
1e-103
1e-104
I've tried storing those numbers under regular notation by using
sprintf to convert: but it's impractical and seems not exact:
here are some of the numbers I obtain:
0.00[...]00000999999999999999957534737399913078515638562734891876822570107876
0.00[...]00010000000000000000015234388133035855383875390450151974382791625208
where the numbers should be 0.00[...]0001. Obviously there are some
conversion issues.
I think one solution could be to write a custom compare block or
function, but I'd rather use a builtin feature of sort. However I
haven't found such a feature in the perl FAQ nor in the groups.
------------------------------
Date: 15 Feb 2007 12:12:52 -0800
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Sorting exponential numbers
Message-Id: <1171570372.084311.212140@m58g2000cwm.googlegroups.com>
On Feb 15, 12:05 pm, "Fabrice Baro" <fabrice.b...@gmail.com> wrote:
> I'm trying to sort a hash whose values are exponential numbers.
>
> foreach my $file (sort values %{$files{$brh}}){
> print "$file\n";}
>
> prints:
> 0
> 1e-101
> 1e-103
> 1e-104
>
> I've tried storing those numbers under regular notation by using
> sprintf to convert: but it's impractical and seems not exact:
> here are some of the numbers I obtain:
> 0.00[...]00000999999999999999957534737399913078515638562734891876822570107876
> 0.00[...]00010000000000000000015234388133035855383875390450151974382791625208
> where the numbers should be 0.00[...]0001. Obviously there are some
> conversion issues.
>
> I think one solution could be to write a custom compare block or
> function, but I'd rather use a builtin feature of sort. However I
> haven't found such a feature in the perl FAQ nor in the groups.
Re-read the section on sort:
$ perldoc -f sort
my %advise = (
use => 0,
the => 1e-101,
spaceship => 1e-103,
operator => 1e-104,
);
for my $v (sort { $a <=> $b } values %advise) {
print $v, "\n";
}
--
Hope this helps,
Steven
------------------------------
Date: 15 Feb 2007 12:27:59 -0800
From: "Fabrice Baro" <fabrice.baro@gmail.com>
Subject: Re: Sorting exponential numbers
Message-Id: <1171571279.143388.121240@v33g2000cwv.googlegroups.com>
[embarrassed]
Thanks Steven,
I had indeed read this, but I went over the fact my sort was a
"numerical" sort.
------------------------------
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 142
**************************************