Re: String Formatting by Column

2011-06-28 Thread Wernher Eksteen
> > That's exactly right. I meant that, if you were using an external file, > you only needed to replace the line > > my $fh = *DATA; > > with > > open my $fh, '<', 'myfile.txt' or die $!; > > which is pretty much what you have done. Unfortunately I made a mistake > and wrote > > while () { > > in

Re: String Formatting by Column

2011-06-28 Thread Rob Dixon
On 28/06/2011 18:28, Wernher Eksteen wrote: Rob use strict; use warnings; use Fcntl 'SEEK_SET'; my $format; my $fh = *DATA; # Replace with the appropriate 'open my $fh, '<', ... or die $!; I wasn't quite sure at first what you meant by passing the file handle in the while loop when $f

Re: String Formatting by Column

2011-06-28 Thread Wernher Eksteen
Hi Rob, I wasn't quite sure at first what you meant by passing the file handle in the while loop when $fh already existed, so I changed the code slightly like this: my $file = "file.txt"; open(my $fh, "<", $file) or die $!; while (<$fh>) { Works like a charm, thanks again! Regards, Wernher

Re: String Formatting by Column

2011-06-26 Thread Wernher Eksteen
Hi Rob, Once again your expertise and willingness to help is astounding. I appreciate the idea that everyone else is trying to force me into learning a new concept I have never encountered before by giving me pointers in the direction such as telling me to look at pack and unpack or the CSV relat

Re: String Formatting by Column

2011-06-25 Thread Rob Dixon
On 24/06/2011 08:45, Wernher Eksteen wrote: > > I've attached a text file containing the original and required > format and avoid the format being lost by just pasting it in the > email body. > > The original format is separated by a space, but need to replace the > space with a comma, so it wil

Re: String Formatting by Column

2011-06-25 Thread Rob Dixon
On 24/06/2011 08:45, Wernher Eksteen wrote: > Hi, > > I've attached a text file containing the original and required > format and avoid the format being lost by just pasting it in the > email body. > > The original format is separated by a space, but need to replace the > space with a comma, so it

Re: String Formatting by Column

2011-06-24 Thread Jim Gibson
At 9:45 AM +0200 6/24/11, Wernher Eksteen wrote: Hi, I've attached a text file containing the original and required format and avoid the format being lost by just pasting it in the email body. The original format is separated by a space, but need to replace the space with a comma, so it will

Re: String Formatting by Column

2011-06-24 Thread Dermot
On 24 June 2011 09:53, Wernher Eksteen wrote: > Hi, > > Thanks for the tip, will try to figure it out on the weekend and come back > if I'm > stuck. > > Just a few questions before I try this... > > Does these modules have the ability to add the commas in the way I need them > to be? Yes. When yo

Re: String Formatting by Column

2011-06-24 Thread Wernher Eksteen
Hi, Thanks for the tip, will try to figure it out on the weekend and come back if I'm stuck. Just a few questions before I try this... Does these modules have the ability to add the commas in the way I need them to be? The CVS_XS.pm module seems more flexible/powerful than the CVS.pm one or am

Re: String Formatting by Column

2011-06-24 Thread Dermot
On 24 June 2011 08:45, Wernher Eksteen wrote: > Hi, > > I've attached a text file containing the original and required format and > avoid the format > being lost by just pasting it in the email body. > > The original format is separated by a space, but need to replace the space > with a comma, > s

String Formatting by Column

2011-06-24 Thread Wernher Eksteen
Hi, I've attached a text file containing the original and required format and avoid the format being lost by just pasting it in the email body. The original format is separated by a space, but need to replace the space with a comma, so it will become a comma delimited csv file which I will then i