[22528] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4749 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 23 18:05:53 2003

Date: Sun, 23 Mar 2003 15:05:09 -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           Sun, 23 Mar 2003     Volume: 10 Number: 4749

Today's topics:
        currency number to text conversion (Cameron)
    Re: currency number to text conversion <earthtrip@gmx.net>
    Re: Editor with Perl as macro language? (Malcolm Dew-Jones)
    Re: Editor with Perl as macro language? <tim@vegeta.ath.cx>
        grep and uninitialized value in concatenation <mstep@t-online.de>
    Re: grep and uninitialized value in concatenation <grazz@nyc.rr.com>
    Re: grep and uninitialized value in concatenation <abigail@abigail.nl>
    Re: grep and uninitialized value in concatenation <mstep@t-online.de>
    Re: grep and uninitialized value in concatenation <grazz@nyc.rr.com>
    Re: grep and uninitialized value in concatenation <mbudash@sonic.net>
    Re: How reliable are Net::FTP status codes? (Tom Beer)
    Re: How stable is 'Magic'? <abigail@abigail.nl>
    Re: How to interchange fields and sorting in perl <goldbb2@earthlink.net>
        Learning programming. <mail@annuna.com>
    Re: Learning programming. <jkeen@concentric.net>
    Re: Learning programming. <mail@annuna.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 23 Mar 2003 11:38:06 -0800
From: cam@ntwk.net (Cameron)
Subject: currency number to text conversion
Message-Id: <e4dad21a.0303231138.c2631a3@posting.google.com>

Hello All --

Has anyone run across a module that handles the conversion of currency
amounts - number to text string and visa versa. For example $500.00 ->
FIVE HUNDRED DOLLARS or FIVE HUNDRED DOLLARS -> $500.00.  I've located
Delphi and VB routines, but nothing in PERL. Any pointers are greatly
appreciated.

Cheers,
Cameron


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

Date: Sun, 23 Mar 2003 22:02:35 +0100
From: Mike <earthtrip@gmx.net>
Subject: Re: currency number to text conversion
Message-Id: <b5l7d9$2aedu1$1@ID-161707.news.dfncis.de>

Cameron wrote:
> Hello All --
> 
> Has anyone run across a module that handles the conversion of currency
> amounts - number to text string and visa versa. For example $500.00 ->
> FIVE HUNDRED DOLLARS or FIVE HUNDRED DOLLARS -> $500.00.  I've located
> Delphi and VB routines, but nothing in PERL. Any pointers are greatly
> appreciated.
> 
> Cheers,
> Cameron
I will have a look for what you are searching. Please post the routines 
you´ve found in VB... I´m looking for that for months...

Mike



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

Date: 23 Mar 2003 11:03:27 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Editor with Perl as macro language?
Message-Id: <3e7e04ff@news.victoria.tc.ca>

Norbert Schmidt (Norbert_Schmidt@DU3.MAUS.DE) wrote:
: Hello folks,

: does anyone know of a program editor for Linux and/or Windows that
: uses Perl as a macro language or is even written itself in Perl? (I'm
: not talking about syntax highlighting.) I would like (X)Emacs, but
: Lisp gives me the creeps.

: Am I the only one who wants that or have I just looked in the wrong
: places?

In windows, in your editor use Edit:Copy and then switch to a command
windows and run a perl script that modifies the paste buffer, and then
switch back to the editor and do Edit:Paste to put the modified text back
into the editor. 

It sounds more complicated than it is.  Using keyboard short cut keys to
switch windows, and command line recall to pull up even compilcated
commands, it all takes just a few keystrokes to run any macro. 

Perl on windows can use some modules to access the clipboard, or I
normally use a couple of utilities that cut/paste in a dos window.

So in addition to having an editor window, open a dos window, cd into the
directory where you keep your editor "macros", and if they are setup as
batch files then simply type the name of the macro in the window when you
need it.

e.g. (from memory so untested) a "macro" W will wrap some text. Make a
file called w.bat

	::bat file W.bat
	wpaste | perl -S -x %0.bat | wcut -
	goto done
	#!perl
	use Text::Wrap;
	undef $/;
	print Wrap(<>);
	__END__
	:done

You can do the same idea in unix if you can setup just two macros in your
editor that copy/replace selected text using a standard file name and all
your perl "macros" then modify that file (e.g. ~/macro.tmp) 



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

Date: 23 Mar 2003 13:05:20 -0800
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: Editor with Perl as macro language?
Message-Id: <slrnb7s7r6.699.tim@vegeta.ath.cx>

Norbert Schmidt graced us by uttering:
> does anyone know of a program editor for Linux and/or Windows
> that uses Perl as a macro language or is even written itself in
> Perl? (I'm not talking about syntax highlighting.)

At work we primarily use a program called Codewright.  It's quite
powerful and every install comes with a built-in perl
distribution and a custom CWP.pm perl module to call codewright
API functions.

Unfortunately, Codewright is commercial software and, though I've
never checked myself, I believe it's in the $200-$300 (US) range.

At home, where I have no such opsys limitations, I used a custom
vim+perl build for several years.

> Am I the only one who wants that or have I just looked in the
> wrong places?

Though all my vim builds were custom compilations, I have seen
vim+perl binary packages available for both linux and
Microsoft(R) Windows(R).  I don't recall a URI at the moment,
though, but they should be available through the
<http://vim.sf.net/> site.

HTH
Tim Hammerquist
-- 
one man [uri guttman], alone,
    standing against the hordes of evil trolls.
one man, with no caps lock, dares to face them.
    -- Helgi Briem in comp.lang.perl.misc (caps removed)


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

Date: Sun, 23 Mar 2003 20:24:23 +0100
From: Marek Stepanek <mstep@t-online.de>
Subject: grep and uninitialized value in concatenation
Message-Id: <BAA3C877.5E14%mstep@t-online.de>

Hello, happy Perl-Coders,


have some complaining of my Perl:

    Use of uninitialized value in concatenation (.) at etc ...

Perl does not like my grep-pattern, with some

    (optional )?(captured patterns)?

while (<GLOBALRESULT_BAK_HTM>){
    s/(ohne|mit)( Limit)( von )?(\d+)?/<SPAN
CLASS=\"wichtig\">$1<\/SPAN>$2$3<SPAN CLASS=\"wichtig\">$4<\/SPAN>/g;
    print GLOBALRESULT_HTM;
}

I tried the search pattern also with

    s/(ohne|mit)( Limit)(( von )(\d+))?/


or with 

    s/(ohne|mit)( Limit)(?:( von )(\d+))?/

but while trying to replace the unmatched ()? with $3 and $4, Perl is
complaining of an uninitialized value. Is there something wrong with my
grep-pattern, or I have to live with it ?



greetings from Munich, spring time here :-)



marek


______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_de________
__________________http://www.PodiumInternational.de___________________
______________________________________________________________________




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

Date: Sun, 23 Mar 2003 20:50:34 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: grep and uninitialized value in concatenation
Message-Id: <u6pfa.6654$iE4.2346042@twister.nyc.rr.com>

Marek Stepanek <mstep@t-online.de> wrote:
> 
> have some complaining of my Perl:
> 
>     Use of uninitialized value in concatenation (.) at etc ...
> 
> Perl does not like my grep-pattern, with some
> 
>     (optional )?(captured patterns)?

You can hush the warnings with

  while (<>) {
    no warnings 'uninitialized';
    ...
  }

HTH
-- 
Steve


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

Date: 23 Mar 2003 21:08:46 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: grep and uninitialized value in concatenation
Message-Id: <slrnb7s8iu.dvl.abigail@alexandra.abigail.nl>

Marek Stepanek (mstep@t-online.de) wrote on MMMCDXCI September MCMXCIII
in <URL:news:BAA3C877.5E14%mstep@t-online.de>:
::  Hello, happy Perl-Coders,
::  
::  
::  have some complaining of my Perl:
::  
::      Use of uninitialized value in concatenation (.) at etc ...
::  
::  Perl does not like my grep-pattern, with some
::  
::      (optional )?(captured patterns)?
::  
::  while (<GLOBALRESULT_BAK_HTM>){
::      s/(ohne|mit)( Limit)( von )?(\d+)?/<SPAN
::  CLASS=\"wichtig\">$1<\/SPAN>$2$3<SPAN CLASS=\"wichtig\">$4<\/SPAN>/g;
::      print GLOBALRESULT_HTM;
::  }


If you have a subpattern of the form '(PAT)?', and there's no (sub)match
for PAT, the corresponding $NUM variable will be undefined.



Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: Sun, 23 Mar 2003 22:26:50 +0100
From: Marek Stepanek <mstep@t-online.de>
Subject: Re: grep and uninitialized value in concatenation
Message-Id: <BAA3E52A.5F4D%mstep@t-online.de>

On 23.03.2003 22:08 Uhr, in article
slrnb7s8iu.dvl.abigail@alexandra.abigail.nl, "Abigail" <abigail@abigail.nl>
wrote:

> Marek Stepanek (mstep@t-online.de) wrote on MMMCDXCI September MCMXCIII
> in <URL:news:BAA3C877.5E14%mstep@t-online.de>:
> ::  Hello, happy Perl-Coders,
> ::  
> ::  
> ::  have some complaining of my Perl:
> ::  
> ::      Use of uninitialized value in concatenation (.) at etc ...
> ::  
> ::  Perl does not like my grep-pattern, with some
> ::  
> ::      (optional )?(captured patterns)?
> ::  
> ::  while (<GLOBALRESULT_BAK_HTM>){
> ::      s/(ohne|mit)( Limit)( von )?(\d+)?/<SPAN
> ::  CLASS=\"wichtig\">$1<\/SPAN>$2$3<SPAN CLASS=\"wichtig\">$4<\/SPAN>/g;
> ::      print GLOBALRESULT_HTM;
> ::  }
> 
> 
> If you have a subpattern of the form '(PAT)?', and there's no (sub)match
> for PAT, the corresponding $NUM variable will be undefined.
> 
> 
> 
> Abigail


thank you Abigail and Steve for your prompt answers. So the grep pattern
itself is ok, if I understood well? So I will put in

        no warnings 'uninitialized';

like Steve suggested.

greetings marek


______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_de________
__________________http://www.PodiumInternational.de___________________
______________________________________________________________________




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

Date: Sun, 23 Mar 2003 21:45:58 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: grep and uninitialized value in concatenation
Message-Id: <qWpfa.7761$iE4.2379292@twister.nyc.rr.com>

Marek Stepanek <mstep@t-online.de> wrote:
> On 23.03.2003 22:08 Uhr, in article
> slrnb7s8iu.dvl.abigail@alexandra.abigail.nl, "Abigail" <abigail@abigail.nl>
> wrote:
> 
>> Marek Stepanek (mstep@t-online.de) wrote on MMMCDXCI September MCMXCIII
>> in <URL:news:BAA3C877.5E14%mstep@t-online.de>:
>> ::  have some complaining of my Perl:
>> ::  
>> ::      Use of uninitialized value in concatenation (.) at etc ...
>> ::  
>> ::  Perl does not like my grep-pattern, with some
>> ::  
>> ::      (optional )?(captured patterns)?
>> ::  
>> ::  while (<GLOBALRESULT_BAK_HTM>){
>> ::      s/(ohne|mit)( Limit)( von )?(\d+)?/<SPAN
>> ::  CLASS=\"wichtig\">$1<\/SPAN>$2$3<SPAN CLASS=\"wichtig\">$4<\/SPAN>/g;
>> ::      print GLOBALRESULT_HTM;
>> ::  }
>> 
>> 
>> If you have a subpattern of the form '(PAT)?', and there's no (sub)match
>> for PAT, the corresponding $NUM variable will be undefined.
> 
> thank you Abigail and Steve for your prompt answers. So the grep pattern
> itself is ok, if I understood well? 

It's fine, as long as you understand where the uninitialized values
are coming from and don't mind using them in the substitution.

Incidentally, you could also avoid the warnings with

  s{(ohne|mit)( Limit(?: von )?)(\d*)}
   {<span class="wichtig">$1</span>$2<span class="wichtig">$3</span>}g;

Or maybe break it into two s/// expressions, one for "mit" and 
one for "ohne" -- since you don't need the second <span/> if there 
aren't digits.

And for future reference, we tend to call them "regular expressions" 
not "grep patterns". :-)

-- 
Steve


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

Date: Sun, 23 Mar 2003 22:08:37 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: grep and uninitialized value in concatenation
Message-Id: <mbudash-C4AD21.14083723032003@typhoon.sonic.net>

In article <BAA3E52A.5F4D%mstep@t-online.de>,
 Marek Stepanek <mstep@t-online.de> wrote:

> On 23.03.2003 22:08 Uhr, in article
> slrnb7s8iu.dvl.abigail@alexandra.abigail.nl, "Abigail" <abigail@abigail.nl>
> wrote:
> 
> > Marek Stepanek (mstep@t-online.de) wrote on MMMCDXCI September MCMXCIII
> > in <URL:news:BAA3C877.5E14%mstep@t-online.de>:
> > ::  Hello, happy Perl-Coders,
> > ::  
> > ::  
> > ::  have some complaining of my Perl:
> > ::  
> > ::      Use of uninitialized value in concatenation (.) at etc ...
> > ::  
> > ::  Perl does not like my grep-pattern, with some
> > ::  
> > ::      (optional )?(captured patterns)?
> > ::  
> > ::  while (<GLOBALRESULT_BAK_HTM>){
> > ::      s/(ohne|mit)( Limit)( von )?(\d+)?/<SPAN
> > ::  CLASS=\"wichtig\">$1<\/SPAN>$2$3<SPAN CLASS=\"wichtig\">$4<\/SPAN>/g;
> > ::      print GLOBALRESULT_HTM;
> > ::  }
> > 
> > 
> > If you have a subpattern of the form '(PAT)?', and there's no (sub)match
> > for PAT, the corresponding $NUM variable will be undefined.
> > 
> > 
> > 
> > Abigail
> 
> 
> thank you Abigail and Steve for your prompt answers. So the grep pattern
> itself is ok, if I understood well? So I will put in
> 
>         no warnings 'uninitialized';
> 
> like Steve suggested.
> 
> greetings marek

that kind of warnings disabling always makes me nervous... just me, i 
guess... i'd do something like this:

s{(ohne|mit)( Limit)( von )?(\d+)?}
 {qq|<SPAN CLASS="wichtig">$1</SPAN>$2| . 
      ($3 || '') . 
    '<SPAN CLASS="wichtig">' . 
      ($4 || '') . 
    '</SPAN>'}e;

no warnings, correct results.

hth-

-- 
Michael Budash


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

Date: 23 Mar 2003 15:00:45 -0800
From: tom.beer@btfinancialgroup.com (Tom Beer)
Subject: Re: How reliable are Net::FTP status codes?
Message-Id: <aa52b6f.0303231500.1927b4c9@posting.google.com>

Chris Lowth <please@no.spam> wrote in message news:<yYzea.43$Sl5.16586@newsfep1-win.server.ntli.net>...
> 
> The FTP protocol does no check-summing, so if corruption occurs, you wont 
> know. I also suspect that truncation cant be reliably trapped (say: due to 
> disk full, etc). Solution - check sum the file yourself locally and 
> remotely, and compare after the transfer.
> 

Thanks Chris. I knew that FTP didn't do that, but I was hoping that Net::FTP did.

Oh well, i guess it doesn't take long.

Tom.


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

Date: 23 Mar 2003 17:55:25 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: How stable is 'Magic'?
Message-Id: <slrnb7rt8c.dvl.abigail@alexandra.abigail.nl>

Asfand Yar Qazi (im_not_giving_it_here@i_hate_spam.com) wrote on MMMCDXCI
September MCMXCIII in <URL:news:b5k2kr$964$1@newsg3.svr.pol.co.uk>:
&&  I asked this is a previous post, but it might not get answered:
&&  
&&  How stable is the 'Magic variables' API?  It says in perlguts it is at 
&&  'patch level 0, and could change at any time'.


The Perl porters are very reluctant to change anything, even if it has
been marked 'experimental', or 'chould change at any time'.

And even if things change, consider that it that there were 2 years
between 5.6.0 and 5.8.0. I don't expect a 5.10 this year; perhaps not
even the year after. Nor has there been any sign that this API will
change.

Is there a garantee the API will never change? Nope. But I don't think
it will ever be marked as "this is never going to change". If perl6
goes to production, both the language and the API will have changed
radically.



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'


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

Date: Sun, 23 Mar 2003 12:22:12 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How to interchange fields and sorting in perl
Message-Id: <3E7DED44.41850BDD@earthlink.net>

Barry Kimelman wrote:
[snip]
> > i want to read that file write back in sorting order f2,f3 and
> > f2 in 1st postion f1 in second postion(inter change the files) . my
> > output should look like this
[snip]
> while ( $buffer = <INPUT> ) {
>     chomp $buffer;
>     @fields = split(/\:/,$buffer);
>     print OUTPUT @fields[1,0,2],"\n";

You've rearranged the output fields as the OP asked, but you've
forgotten to sort!

If you'd tested your code, and compared it's output with the desired
output shown in the original post, you'd have known you were wrong.

If your code is untested (as yours clearly is), you should add a note
saying "[untested]" somewhere in it.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Sun, 23 Mar 2003 12:56:13 -0600
From: Joe Creaney <mail@annuna.com>
Subject: Learning programming.
Message-Id: <3E7E034D.3000000@annuna.com>

I have just started teaching myself how to program and I am trying to 
write a role playing game.  I will keep plugging the site any my game at 
www.annuna.com/perl5 .  I learned baic programming about 15-20 years ago 
using TI or apple basic.  I understand the basics of programming but I 
am having trouble trying to make a good program.  I ave looked at Perl 
Java and C++ and they have alot in common.  Are there any good resources 
that teaching programming meathods, ooks or courses?  I learned alot of 
basic programming from programms in magizines.  Are there paces to go 
see different programs?



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

Date: 23 Mar 2003 19:28:25 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Learning programming.
Message-Id: <b5l1sp$bph@dispatch.concentric.net>


"Joe Creaney" <mail@annuna.com> wrote in message
news:3E7E034D.3000000@annuna.com...
> I have just started teaching myself how to program and I am trying to
> write a role playing game.  I will keep plugging the site any my game at
> www.annuna.com/perl5 .  I learned baic programming about 15-20 years ago
> using TI or apple basic.  I understand the basics of programming but I
> am having trouble trying to make a good program.  I ave looked at Perl
> Java and C++ and they have alot in common.  Are there any good resources
> that teaching programming meathods, ooks or courses?

Go to http://learn.perl.org





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

Date: Sun, 23 Mar 2003 15:03:02 -0600
From: Joe Creaney <mail@annuna.com>
Subject: Re: Learning programming.
Message-Id: <3E7E2106.1070007@annuna.com>



James E Keenan wrote:
> "Joe Creaney" <mail@annuna.com> wrote in message
> news:3E7E034D.3000000@annuna.com...
> 
>>I have just started teaching myself how to program and I am trying to
>>write a role playing game.  I will keep plugging the site any my game at
>>www.annuna.com/perl5 .  I learned baic programming about 15-20 years ago
>>using TI or apple basic.  I understand the basics of programming but I
>>am having trouble trying to make a good program.  I ave looked at Perl
>>Java and C++ and they have alot in common.  Are there any good resources
>>that teaching programming meathods, ooks or courses?
> 
> 
> Go to http://learn.perl.org
> 
> 
>


  Thank you very much I will check it out.



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

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 4749
***************************************


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