Hello Marek,

I still don't understand what are you trying to do.

$1 and S2 and so on are reserved words. hm
I still don't understand why you are using anonymous arrays and references.
Perhaps I am wrong but I am very tired and I have drunk some wine.


If I want to add a list of numbers I do this:
--------START--------------------
#!/usr/bin/perl

my @A = (2, 4.98, 6.45, 8);
foreach $element (@A) {
$result += $element;
}
print join (" + ",@A)." = ";
$result = sprintf "%.2f\n", $result;
print $result;
---------END----------------------

This script prints this:
2 + 4.98 + 6.45 + 8 = 21.43

Please tell my what are do you want to do exactly.
I need more information.
Thanks.
Best regards,
--
Michael Havlicek
Le Aug 3, 2007, à 9:22 PM, Marek Stepanek a écrit :



Hello all,


have a simple task to accomplish.

A Perl-filter to write some Perl ...

from

    my $1,

to

    my ($1, $2, $3, $4);

Should be simple, but something is not working here, and I don't understand
why (yes yes, I am beginner):

#!/usr/bin/perl

use strict;
use warnings;

while (<>) {
    foreach (1..4) {
            s/ \$(\d),/ \$$1+$_,/eg;
        }
    print;
}


this childish attempt is doing nothing ...

greetings to all


marek



-- ----------------------------------------------------------------------- -
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>



--
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to