--- loncom/interface/spreadsheet/Spreadsheet.pm	2007/01/23 01:29:15	1.73
+++ loncom/interface/spreadsheet/Spreadsheet.pm	2007/01/23 01:36:26	1.74
@@ -1,5 +1,5 @@
 #
-# $Id: Spreadsheet.pm,v 1.73 2007/01/23 01:29:15 albertel Exp $
+# $Id: Spreadsheet.pm,v 1.74 2007/01/23 01:36:26 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -805,7 +805,7 @@ sub expandnamed {
     my $self = shift;
     my $expression=shift;
     if ($expression=~/^\&/) {
-	my ($func,$var,$formula)=($expression=~/^\&(\w+)\(([^\;]+)\;(.*)\)/);
+	my ($func,$var,$formula)=($expression=~/^\&(\w+)\(([^\;]+)\;(.*)\)/s);
 	my @vars=split(/\W+/,$formula);
 	# make the list uniq
 	@vars = keys(%{{ map { $_ => 1 } @vars }});
@@ -892,7 +892,7 @@ sub sett {
             # Replace 'A0' with the value from 'A0'
             $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;
             # Replace parameters
-            $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/ge;
+            $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/sge;
         }
     }
     #
@@ -904,7 +904,7 @@ sub sett {
             $t{$cell}=$formula;
             $t{$cell}=~s/\.\.+/\,/g;
             $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;
-            $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/ge;
+            $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/sge;
         } elsif  ( $col  =~ /^[A-Z]$/  ) {
             if ($formula !~ /^\!/ && exists($self->{'constants'}->{$cell})
 		&& $self->{'constants'}->{$cell} ne '') {
@@ -915,7 +915,7 @@ sub sett {
             $t{$cell}=$formula;
             $t{$cell}=~s/\.\.+/\,/g;
             $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;
-            $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/ge;
+            $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/sge;
         }
     }
     %{$self->{'safe'}->varglob('t')}=%t;