On May 31, Jonathan E. Paton said:
--- Ned Cunningham [EMAIL PROTECTED] wrote: Snip
I want to write to a file all of the array(@data), except the first
field
@data[1..-1]
means the array @data from element 1 to the last element.
Sadly, Perl does not support that syntax. Ranges must
Jonathan, et al --
...and then Jonathan E. Paton said...
%
% --- Ned Cunningham [EMAIL PROTECTED] wrote: Snip
%
...
% @data = split(/\|/,$line);
% $newnum=$newnum+1;
% printf WRFILE (0%9d,$newnum);
%
% print WRFILE ;, @data, ;;
...
%
% I want to write to a file all of the
beginners
Cc: Jonathan E. Paton
Subject:Re: Printing all elements of an Array except
the first?
Jonathan, et al --
...and then Jonathan E. Paton said...
%
% --- Ned Cunningham [EMAIL PROTECTED
Ned --
...and then Ned Cunningham said...
%
% Great,
% Now how about sorting on the new first element of the array each time I
% step through a file???
How about a little more detail? I'm not sure quite what you mean by
new; you top-posted instead of providing any contextual reference.
Given
I want to write to a file all of the array(@data), except the first
field
@data[1..-1]
means the array @data from element 1 to the last element.
Sadly, Perl does not support that syntax. Ranges must be
low..high. @foo[1..-1] doesn't work.
Jonathan throttles the camel
:Re: Printing all elements of an Array except
the first?
Ned --
...and then Ned Cunningham said...
%
% Great,
% Now how about sorting on the new first element of the
array each time I
% step through
element.
Any better ideas friends??
-Original Message-
From: Ned Cunningham [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 31, 2002 11:27 AM
To: 'David T-G'; perl beginners
Cc: Ned Cunningham
Subject: RE: Printing all elements of an Array except the first?
OOPS :-(
I wanted to sort
Ned --
...and then Ned Cunningham said...
%
% OOPS :-(
% I wanted to sort the file that I am writing, by the second element in @DATA?
OK. You're also writing out a count number, it looks like:
% Snip
% open CUST, $cust or die Cant open it :$!;
% open WRFILE, $wrfile;
%
% while (defined
}}, ;, \n;
}
}
close (WRFILE);
__END__
#
-Original Message-
From: Shishir K. Singh
Sent: Friday, May 31, 2002 11:53 AM
To: 'Ned Cunningham'; 'David T-G'; perl beginners
Subject: RE: Printing all elements of an Array except the first