[23544] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5752 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 5 09:05:49 2003

Date: Wed, 5 Nov 2003 06:05:11 -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           Wed, 5 Nov 2003     Volume: 10 Number: 5752

Today's topics:
        [newbie] How to pass in perl variables between web page (Pedro)
    Re: Big problem with @array and Chomp ... I think :o <ducott_99@yahoo.com>
    Re: Changing from capital letters to small letters usin <noreply@gunnar.cc>
    Re: Changing from capital letters to small letters usin <bigiain@mightymedia.com.au>
    Re: Changing from capital letters to small letters usin <bigiain@mightymedia.com.au>
    Re: Changing from capital letters to small letters usin <founder@pege.org>
    Re: Changing from capital letters to small letters usin <noreply@gunnar.cc>
    Re: Changing from capital letters to small letters usin <jurgenex@hotmail.com>
    Re: Changing from capital letters to small letters usin <grazz@pobox.com>
    Re: Changing from capital letters to small letters usin <tassilo.parseval@rwth-aachen.de>
    Re: Changing from capital letters to small letters usin <abigail@abigail.nl>
    Re: Changing from capital letters to small letters usin <noreply@gunnar.cc>
        file copy.. <nojunk@please.com>
        Logical Xor <fJogham@yahoo.com>
    Re: Logical Xor <josef.moellers@fujitsu-siemens.com>
    Re: Logical Xor <kalinaubears@iinet.net.au>
    Re: Logical Xor <fJogham@yahoo.com>
        MIME::Lite on ActivePerl <anuratic@mailcity.com>
    Re: MIME::Lite on ActivePerl <kalinaubears@iinet.net.au>
    Re: Newbie question - create a file <me@privacy.net>
    Re: printing characters <tom@nosleep.net>
    Re: printing characters <fJogham@yahoo.com>
    Re: Problem Connecting w Perl/DBD::Oracle as SYSDBA <r_reidy@comcast.net>
    Re: Rounding a float in Perl? (Anno Siegel)
        Sorting in Safe compartments under Perl 5.8 <fiedorow@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 05 Nov 2003 07:58:48 +0000
From: pedro.fabre.NO-SPAM@gen.gu.se (Pedro)
Subject: [newbie] How to pass in perl variables between web pages?
Message-Id: <pedro.fabre.NO-SPAM-0511030758480001@192.168.0.5>

Dear all,


I am trying to pass the whole set of variables from a page to the result
one and then process this result on the output file. I know that this can
be bone on perl but I have no idea, how to do it. Or where to look
information related to that.

Any help will be appreciated.

Pedro


------------------------------

Date: Wed, 05 Nov 2003 05:38:35 GMT
From: "Robert TV" <ducott_99@yahoo.com>
Subject: Re: Big problem with @array and Chomp ... I think :o
Message-Id: <v10qb.300317$9l5.11618@pd7tw2no>

YES YES YES!!!!!  Your code examples have fixed my problem. I had no idea
that there were "\r"s AND "\n"s present in each newline, and now that I
replace the "\r\n" with just "\n" the code is working correctly. You are the
best man!

Robert

"Kevin Shay" <kevin_shay@yahoo.com> wrote in message
news:5550ef1e.0311041948.60c234ab@posting.google.com...
> "Robert TV" <ducott_99@yahoo.com> wrote in message
> news:<j0Tpb.290847$6C4.168943@pd7tw1no>...
> > @recipients = CGI::param('csvdata');
> >
> > open (FILE,">>$activeuser/csvdump.txt");
> > close(FILE);
> >
> > open (ADDRESSES, ">$activeuser/csvdump.txt") or die "Can't open file:
$!";
> >   print ADDRESSES @recipients;
> > close(ADDRESSES);
> >
> > open (ADDRESSES, "<$activeuser/csvdump.txt") or die "Can't open file:
$!";
> >   @recipients = <ADDRESSES>;
> > close(ADDRESSES);
> >
> > unlink <$activeuser/csvdump.txt>;
> >
> > <-- End Code Example -->
> >
> > Ok, right about now your wondering why did I take the form contents,
write
> > it to a temp file, then open and get the data back from the temp file.
For
> > some reason I cannot get the code to work any other way.
>
> The problem may lie in the first line of code above:
>
> @recipients = CGI::param('csvdata');
>
> It sounds like you have a single HTML form field called csvdata, into
> which the user enters multiple lines of text. If that's the case, the
> CGI module will not automatically turn this into a list. It's a single
> value. So the entire set of data is being placed into the first
> element of @recipients.
>
> When you print that one-element array to a file, it simply prints that
> one element; the element happens to have multiple lines, so the
> resulting file will have multiple lines. Then, when you re-open the
> file and do this:
>
> @recipients = <ADDRESSES>;
>
> Perl reads the lines of the file into the array, one line per element,
> which is what you wanted in the first place. So you could probably
> just do this to avoid the whole temp file workaround:
>
> @recipients = split(/\n/, CGI::param('csvdata'));
>
> As for the actual chomp problem, it may have something to do with the
> way different operating systems encode newlines differently (\n on
> Unix, \r\n on DOS/Windows, \r on Mac). Depending on which platform the
> user's browser is running on, you may not be getting just \n
> characters separating the lines. So you might want to normalize
> everything to \n newlines:
>
> my $csvdata = CGI::param('csvdata');
> $csvdata =~ s/\r\n?/\n/g;
> @recipients = split(/\n/, $csvdata);
>
> Kevin
> --
> perl -MLWP::UserAgent -e '$u=new LWP::UserAgent;$u->agent("japh");
> print join(" ",(split(/\s+/,(split/\n/,$u->request(HTTP::Request->
> new(GET=>join("",split(/\n/,"http://groups.google.com/groups?selm=
> 4365%40omepd.UUCP&output=gplain"))))->content)[60]))[0..3]),",\n"'




------------------------------

Date: Wed, 05 Nov 2003 06:26:13 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <boa1lp$1c85dj$1@ID-184292.news.uni-berlin.de>

Venugopal wrote:
> Is there an easy way to change all capital letters in a text file 
> to small letters using Perl?

http://www.perldoc.com/perl5.8.0/pod/perlop.html#tr-SEARCHLIST-REPLACEMENTLIST-cds

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Wed, 05 Nov 2003 16:35:35 +1100
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <bigiain-E73CF6.16353505112003@news.fu-berlin.de>

In article <68041301.0311042041.1dc4f858@posting.google.com>,
 balasubv@hotmail.com (Venugopal) wrote:

> Hi,
> 
> Is there an easy way to change all capital letters in a text file 
> to small letters using Perl? (Or any other tool!)

Yep, perl has a "lower case" function called "lc"

perldoc -f lc

A short example:

#!/usr/bin/perl -w
use strict;
undef $/;         #enable 'slurp' mode
open(FILE,'filename.txt') || die $!;
$_=<FILE>;        #read entire file into $_
close FILE;
print lc;         #print lowercase version (lc defaults to $_)
__END__

cheers,

big (yeah yeah, theres no need to not do it line by line...)

-- 
'When I first met Katho, she had a meat cleaver in one hand and
half a sheep in the other. "Come in", she says, "Hammo's not here.
I hope you like meat.' Sharkey in aus.moto


------------------------------

Date: Wed, 05 Nov 2003 17:03:22 +1100
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <bigiain-4AE1C9.17032205112003@news.fu-berlin.de>

In article <boa1lp$1c85dj$1@ID-184292.news.uni-berlin.de>,
 Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:

> Venugopal wrote:
> > Is there an easy way to change all capital letters in a text file 
> > to small letters using Perl?
> 
> http://www.perldoc.com/perl5.8.0/pod/perlop.html#tr-SEARCHLIST-REPLACEMENTLIST-cds


which directs you to:

"If you want to map strings between lower/upper cases, see 
perlfunc/lc and perlfunc/uc"

out of interest, I did this:

#!/usr/bin/perl -w
use strict;
use Benchmark;

my $text='aBcDeFgHiJkLmNoPqUsTuVwXyZ';
my $result;

timethese(1000000, {
              'lc' => sub {$result=lc($text)},
              'tr' => sub {($result = $text)=~ tr/A-Z/a-z/;},
          });

and got this:

Benchmark: timing 1000000 iterations of lc, tr...
        lc:  0 wallclock secs ( 1.67 usr +  0.00 sys =  1.67 CPU) 
@ 598802.40/s (n=1000000)
        tr:  3 wallclock secs ( 2.40 usr +  0.00 sys =  2.40 CPU) 
@ 416666.67/s (n=1000000)


which makes lc look quite a bit quicker. If I change it so

my $text='aBcDeFgHiJkLmNoPqUsTuVwXyZ' x 100;

I get:

Benchmark: timing 1000000 iterations of lc, tr...
        lc: 64 wallclock secs (46.09 usr +  0.00 sys = 46.09 CPU) 
@ 21696.68/s (n=1000000)
        tr: 78 wallclock secs (55.29 usr +  0.00 sys = 55.29 CPU) 
@ 18086.45/s (n=1000000)

And, of course, lc knows about locale where tr doesn't...

big

-- 
'When I first met Katho, she had a meat cleaver in one hand and
half a sheep in the other. "Come in", she says, "Hammo's not here.
I hope you like meat.' Sharkey in aus.moto


------------------------------

Date: Wed, 5 Nov 2003 07:25:33 +0100
From: =?iso-8859-1?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <3fa897ed$0$44024$91cee783@newsreader02.highway.telekom.at>

> Is there an easy way to change all capital letters in a text file
> to small letters using Perl? (Or any other tool!)

$text =~ y/A-Z/a-z/;


-- 
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine





------------------------------

Date: Wed, 05 Nov 2003 07:45:58 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <boa6c0$1blbp6$1@ID-184292.news.uni-berlin.de>

Iain Chalmers wrote:
> Gunnar Hjalmarsson wrote:
>> Venugopal wrote:
>>> Is there an easy way to change all capital letters in a text
>>> file to small letters using Perl?
>> 
>> http://www.perldoc.com/perl5.8.0/pod/perlop.html#tr-SEARCHLIST-REPLACEMENTLIST-cds
> 
> which directs you to:
> 
> "If you want to map strings between lower/upper cases, see 
> perlfunc/lc and perlfunc/uc"

Maybe. I thought this would be an appropriate task for a one liner,
and I made this work:

     $ perl -p -e 'tr/A-Z/a-z/' < oldfile.txt > newfile.txt

but didn't find any way to do it using lc(). (As a W98 user I almost
never play with one liners...)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Wed, 05 Nov 2003 07:03:01 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <Fg1qb.6103$n9.3797@nwrddc02.gnilink.net>

Roland Mösl wrote:
>> Is there an easy way to change all capital letters in a text file
>> to small letters using Perl? (Or any other tool!)
>
> $text =~ y/A-Z/a-z/;

Which of course works only for a small subset of letters even in
ISO-Latin-1, not to mention other character sets.
Better to use the proper function lc().

jue




------------------------------

Date: Wed, 05 Nov 2003 07:18:50 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <uv1qb.2589$m55.2516@nwrdny02.gnilink.net>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> I thought this would be an appropriate task for a one liner,
> and I made this work:
> 
>      $ perl -p -e 'tr/A-Z/a-z/' < oldfile.txt > newfile.txt
> 
> but didn't find any way to do it using lc().

    % perl -pe '$_ = lc' old > new
 
-- 
Steve


------------------------------

Date: 5 Nov 2003 09:18:10 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <boaf8i$qd6$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Jürgen Exner:

> Roland Mösl wrote:
>>> Is there an easy way to change all capital letters in a text file
>>> to small letters using Perl? (Or any other tool!)
>>
>> $text =~ y/A-Z/a-z/;
> 
> Which of course works only for a small subset of letters even in
> ISO-Latin-1, not to mention other character sets.
> Better to use the proper function lc().

Plus 'use locale', otherwise lc() will just handle those characters in
the ASCII character set.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: 05 Nov 2003 12:49:55 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <slrnbqhsfj.g7h.abigail@alexandra.abigail.nl>

Gunnar Hjalmarsson (noreply@gunnar.cc) wrote on MMMDCCXVIII September
MCMXCIII in <URL:news:boa6c0$1blbp6$1@ID-184292.news.uni-berlin.de>:
~~  Iain Chalmers wrote:
~~ > Gunnar Hjalmarsson wrote:
~~ >> Venugopal wrote:
~~ >>> Is there an easy way to change all capital letters in a text
~~ >>> file to small letters using Perl?
~~ >> 
~~ >> http://www.perldoc.com/perl5.8.0/pod/perlop.html#tr-SEARCHLIST-REPLACEMENTLIST-cds
~~ > 
~~ > which directs you to:
~~ > 
~~ > "If you want to map strings between lower/upper cases, see 
~~ > perlfunc/lc and perlfunc/uc"
~~  
~~  Maybe. I thought this would be an appropriate task for a one liner,
~~  and I made this work:
~~  
~~       $ perl -p -e 'tr/A-Z/a-z/' < oldfile.txt > newfile.txt

         $ perl -p -e '$_=lc' < oldfile.txt > newfile.txt

~~  but didn't find any way to do it using lc(). (As a W98 user I almost
~~  never play with one liners...)


The program using lc is less than 50% of the program using tr///. ;-)


Abigail
-- 
   my $qr =  qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
      $qr =~  s/$qr//g;
print $qr, "\n";


------------------------------

Date: Wed, 05 Nov 2003 14:26:32 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Changing from capital letters to small letters using perl
Message-Id: <boatsl$1c858q$1@ID-184292.news.uni-berlin.de>

Steve Grazzini wrote:
> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> 
>>I thought this would be an appropriate task for a one liner,
>>and I made this work:
>>
>>     $ perl -p -e 'tr/A-Z/a-z/' < oldfile.txt > newfile.txt
>>
>>but didn't find any way to do it using lc().
> 
> 
>     % perl -pe '$_ = lc' old > new

Thanks. Stupid mistake (of course): I tried 'lc' instead of '$_ = lc'.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Wed, 5 Nov 2003 13:50:55 -0000
From: "Nimmy" <nojunk@please.com>
Subject: file copy..
Message-Id: <boavko$tgk$1@kermit.esat.net>

Any one have a script to run on my Windows Xp machine for the following file
operations:

a) I have a file called xyz.ppt
b) If the time and date stamp changed, I mean basically if the file has been
modified, I want the SCRIPT to copy/overwrite that file in few other
different directory folders.

Why do I want to do this?
- I may have to do for different other files, iterative
- I have to copy them on my network drive as well from my C: drive
- To avoid manual copying all the times.

Thanks




------------------------------

Date: Wed, 05 Nov 2003 17:24:38 +1100
From: Fred <fJogham@yahoo.com>
Subject: Logical Xor
Message-Id: <3FA897A6.2040808@yahoo.com>

Hello

I am trying to get the answer for this but cann't. don't know why.
#!/usr/bin/perl
use strict;
use warnings;

my $a = 100000;
my $b = 010000;
print ($a  Xor $b), "\n";

thanks for helping



------------------------------

Date: Wed, 05 Nov 2003 08:21:40 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Logical Xor
Message-Id: <3FA8A504.C9550488@fujitsu-siemens.com>

Fred wrote:
> =

> Hello
> =

> I am trying to get the answer for this but cann't. don't know why.

Perhaps because you don't have a question?

> #!/usr/bin/perl
> use strict;
> use warnings;
> =

> my $a =3D 100000;
> my $b =3D 010000;
> print ($a  Xor $b), "\n";
> =

> thanks for helping

Also, are you aware that your code is probably not what you think it is
(hint: decimal vs. octal)?
Also, are you aware that the use of $a and $b is deprecated (hint:
perldoc -f sort)?

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


------------------------------

Date: Wed, 05 Nov 2003 18:41:56 +1100
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Logical Xor
Message-Id: <3fa8aa82$0$1727$5a62ac22@freenews.iinet.net.au>

Fred wrote:
> Hello
> 
> I am trying to get the answer for this but cann't. don't know why.
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> my $a = 100000;
> my $b = 010000;
> print ($a  Xor $b), "\n";
> 
> thanks for helping
> 

use warnings;

my $a = 0b100000;
my $b = 0b010000;

printf "%b\n", $a ^ $b;
print $a ^ $b, "\n";

$a = 100000;
$b = 010000;

printf "%b\n", $a;
printf "%b\n", $b;
printf "%b\n", $a ^ $b;
print $a ^ $b, "\n";

Hth.

Cheers,
Rob


-- 
To reply by email u have to take out the u in kalinaubears.



------------------------------

Date: Wed, 05 Nov 2003 19:36:58 +1100
From: Fred <fJogham@yahoo.com>
Subject: Re: Logical Xor
Message-Id: <3FA8B6AA.4010406@yahoo.com>

Josef Möllers wrote:
> Fred wrote:
> 
>>Hello
>>
>>I am trying to get the answer for this but cann't. don't know why.
> 
> 
> Perhaps because you don't have a question?
> 
> 
>>#!/usr/bin/perl
>>use strict;
>>use warnings;
>>
>>my $a = 100000;
>>my $b = 010000;
>>print ($a  Xor $b), "\n";
>>
>>thanks for helping
> 
> 
> Also, are you aware that your code is probably not what you think it is
> (hint: decimal vs. octal)?
> Also, are you aware that the use of $a and $b is deprecated (hint:
> perldoc -f sort)?
> 

what I am trying to get is the result of 100000 Xor 010000 which is
100000
010000
=
110000

or the and operator 100000 and 010000

100000
010000
=
000000

who is that done in perl, I appriciate any to-the-point reading.

thanks



------------------------------

Date: Wed, 05 Nov 2003 10:42:46 GMT
From: "Anurat Chapanond" <anuratic@mailcity.com>
Subject: MIME::Lite on ActivePerl
Message-Id: <Gu4qb.53491$ZC4.4074@twister.nyroc.rr.com>

Hi,
    I want to do automatic email sending on my windows machine. So I get
ActivePerl installed on my machine. I think I need MIME::Lite in order to do
automatic email sending. However I'm not sure if the package is for unix
only or it can be installed on windows as well. I'm really new to Perl. Any
advice would be appreciated.

Thank you,
Anurat




------------------------------

Date: Wed, 05 Nov 2003 22:07:09 +1100
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: MIME::Lite on ActivePerl
Message-Id: <3fa8da9c$0$1721$5a62ac22@freenews.iinet.net.au>

Anurat Chapanond wrote:
> Hi,
>     I want to do automatic email sending on my windows machine. So I get
> ActivePerl installed on my machine. I think I need MIME::Lite in order to do
> automatic email sending. However I'm not sure if the package is for unix
> only or it can be installed on windows as well. I'm really new to Perl. Any
> advice would be appreciated.
> 

ActivePerl might already have MIME::Lite installed.

If not, while connected to the internet, enter:
ppm install MIME-Lite

Cheers,
Rob


-- 
To reply by email u have to take out the u in kalinaubears.



------------------------------

Date: Wed, 5 Nov 2003 22:29:03 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: Newbie question - create a file
Message-Id: <boafuh$1cb2sh$1@ID-172104.news.uni-berlin.de>


"Pedro" <hexkid@hotpop.com> wrote in message
news:bo8f0t$1aueih$1@ID-203069.news.uni-berlin.de...
> Blue Cat wrote:
> > After toiling over "open" in the Perl docs and the Camel Book with no
> > success, I am asking for help:
> >
> > How do I create a file named "dogs.txt" and write "My dog is a golden
> > retriever." into it?
>
> Newbie answer:
>
> $ cat dogs.pl
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> open FILE, "> dogs.txt";

Should be

open FILE, ">dogs.txt" or die "Could not open dogs.txt because $!\n";

> print FILE "My dog is a golden retriever\n";
> close FILE;
>
>
> $ cat dogs.txt
> My dog is a golden retriever
>
>
> HTH
>
> -- 
> I have a spam filter working.
> To mail me include "urkxvq" (with or without the quotes)
> in the subject line, or your mail will be ruthlessly discarded.




------------------------------

Date: Tue, 4 Nov 2003 22:03:18 -0800
From: "Tom" <tom@nosleep.net>
Subject: Re: printing characters
Message-Id: <3fa8a0b2$1@nntp0.pdx.net>


"Abigail" <abigail@abigail.nl> wrote in message
news:slrnbqgl3n.mjj.abigail@alexandra.abigail.nl...
> Fred (fJogham@yahoo.com) wrote on MMMDCCXVII September MCMXCIII in
> <URL:news:3FA8337D.9070303@yahoo.com>:
> @@  Hello
> @@
> @@  how can I print Squars and triangles and reversed triangles, sold
> @@  squares, arrows in perl?
>
LMFAO
thnx ;)




------------------------------

Date: Wed, 05 Nov 2003 18:37:11 +1100
From: Fred <fJogham@yahoo.com>
Subject: Re: printing characters
Message-Id: <3FA8A8A7.7010100@yahoo.com>

Bob Walton wrote:
> Fred wrote:
> 
> ...
> 
>> how can I print Squars and triangles and reversed triangles, sold 
>> squares, arrows in perl?
> 
> ...
> 
> Hmmmm...not sure exactly what you're asking.  You could
> 
>    use GD;
> 
> to generate the image you want, and then print that using a browser or 
> art package, perhaps automating the print via command-line switches for 
> the browser or art package if a browser/package with such functionality 
> is chosen.
> 
> If you mean "how can I print characters from an oddball font", the 
> answer to that will be very platform/OS dependent, and you haven't said 
> what your platform/OS is.  It might be printer-dependant too, depending 
> on your platform/OS.
> 
just like 0x03B1 is a code point for the GREEK SMALL LETTER ALPHA. I 
thought there  would be a list where images would have some code points 
then I choose the right code point for what ever image I would like to 
output. hummmmm is must be more complicated than that from the responses 
I got.

thanks



------------------------------

Date: Wed, 05 Nov 2003 05:54:44 -0700
From: Ron Reidy <r_reidy@comcast.net>
Subject: Re: Problem Connecting w Perl/DBD::Oracle as SYSDBA
Message-Id: <3FA8F314.2000405@comcast.net>

Can you (the same OS user) connect as sysdba via SQL*Plus to instance BB?

Is your Oracle environment correct (I see you set ORACLE_SID, but what 
about ORACLE_HOME, etc.)?

[snip]
> use DBI;
> use DBD::Oracle qw(:ora_session_modes);
> use diagnostics;
> use strict;
> 
> my $db_name     = "AA";                 # or "BB"
> my $user        = "sys";
> my $passwd      = "pswd123";
> 
> $ENV{ORACLE_SID} = $db_name;
> 
> ...
> 
> my $dbh = DBI->connect("dbi:Oracle:".$db_name ,$user ,$passwd, {
>     ora_session_mode => ORA_SYSDBA,
>     RaiseError => 1,
>     AutoCommit => 0 }
> )
>   or die "Can't open $db_name database: $DBI::errstr";
> $dbh->commit();
> 
> ...  <do some SELECT statements, etc...>
> 
> $sth->finish();
> $dbh->disconnect;
> ...
> 
> ----------------------
> 
> The crazy thing is, my program (bk3.pl) WORKS for one database (AA) but 
> NOT for the other (database BB).
> 
> I have carefully examined the differences between the two 
> database/instances and can find none of consequence.
> 
> The error I get when running this for database BB seems to be occuring 
> in the DBI library, at the exact point of connection to the database. 
> The error is:

Did you step through using the debugger?

> 
>         Uncaught exception from user code:
>         DBI connect('bb','sys',...) failed:  at ./bk3.pl line 80
>         Carp::croak('DBI connect(\'bb\',\'sys\',...) failed: ') called 
>  at /usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm line 579
>         DBI::__ANON__() called at 
> /usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm line 629
>         DBI::connect('DBI', 'dbi:Oracle:bb', 'sys', 'pswd123', 
> 'HASH(0x8335710)') called at ./bk3.pl line 80
> 
> The main error seems to be line 579 of 
> /usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm but I can't be sure.
> 
> I have tried many variations of the syntax on the connect statement.  I 
> have tried making changes to the tnsnames.ora file and restarting the 
> Oracle listener several times.  I have tried the alternate syntax which 
> bypasses/ignores the Oracle listener process.  But in each scenario, the 
> program often works for instance AA, but never for instance BB.

It is not the syntax.

> 
> Note however that the connect DOES work for both AA and BB when I try to 
> connect as a regualr user and NOT as "sys".  So..
> 
>         Something is wrong when connecting as "sys" on any instance 
> other than "AA" with the sysdba directive:
>                 "ora_session_mode => ORA_SYSDBA"
>         as obtained from the DBD::Oracle library.
> 
> SO.. I'm stumped!  Does anyone have some ideas on this particular 
> situation?   I am sure that we are using the latest DBD::Oracle library, 
> version 1.14.
> 
> Many thanks for your assistance.
> 
> --Jim Longwill  :^)
> 


-- 
Ron Reidy
Oracle DBA



------------------------------

Date: 5 Nov 2003 08:31:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Rounding a float in Perl?
Message-Id: <boachj$roh$1@mamenchi.zrz.TU-Berlin.DE>

Roy Johnson <rjohnson@shell.com> wrote in comp.lang.perl.misc:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message
> news:<bo8rm2$n4$1@mamenchi.zrz.TU-Berlin.DE>...
> > What is the mathematically accurate result of rounding 0.05 to one
> > decimal place?
> 
> Convention says it rounds up. Maybe that's not mathematics, per se.
> Maybe it's not even a universal convention, but it's the only one I
> ever heard.

The convention has the disadvantage that it's biased.  Positive numbers
will on average become larger and negatives become smaller.

> > However, your solution now differs from sprintf when rounding 0.5 to
> > an integer: sprintf says 0, stround says 1.
> 
> I'm actually happy with that, because it's consistent and
> conventional. sprintf's inconsistent rounding is lamented in the FAQ.

It may look inconsistent, but there are reasons for that.  Compilers
of mathematical tables have used it for centuries.

> > If I had to *prove* an implementation conforms to some standard, I'd
> > prefer a numeric solution
> 
> Except for the fact that numeric representation is the problem. Using
> the strings is the workaround. As an internal number, there may be no
> such thing as exactly 3.005, but as a string, there is.

Numeric representation is a problem, but the purpose of rounding isn't
to show you the string you expect from looking at the (already rounded)
standard representation of the number.  It must come up with a repre-
sentable approximation to the true rounded value.

Anno


------------------------------

Date: Wed, 05 Nov 2003 07:46:11 -0500
From: Zbigniew Fiedorowicz <fiedorow@hotmail.com>
Subject: Sorting in Safe compartments under Perl 5.8
Message-Id: <boarem$cbp$1@charm.magnus.acs.ohio-state.edu>

I've run into problem in using sort under Perl 5.8.0 running under the 
Linux Redhat 9.0 distribution.  The code works flawlessly under Perl 
5.6.0 under Linux Redhat 7.2. Under 5.8.0/RH 9.0 sorting fails with 
error messages of the form:

Use of uninitialized value in numeric comparison (<=>) at (eval 2)

I'd be particularly interested in hearing whether this code works under 
Perl 5.8.0 under other operating systems.

Here's the code:
----------- cut here ----------------------
#!/usr/bin/perl -w

use strict;
use Safe;

sub PGsort {
     local($a,$b);
         my $compare = shift;

         sort {&$compare($a, $b) } @_;
}


my   $cmp = new Safe;
print "Safe version $Safe::VERSION\n";

$cmp->share('&PGsort');
my $string = <<'EOF';

my @list = (4,6,2, 5 ,10, 8, 9 );

my $str = join( " ", PGsort  sub {$_[0]  <=> $_[1] } , @list );

print $str;

EOF

$cmp->reval($string);
----------- cut here ----------------------

Thanks in advance,
Zbigniew Fiedorowicz



------------------------------

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.  

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 V10 Issue 5752
***************************************


home help back first fref pref prev next nref lref last post