Bestrophin has asked for the wisdom of the Perl Monks concerning the following question:
Hi Everyone,
I have the below program which was written for MAC OS 1997. And now I would like to use this program to run this in windows vista in the active perl.
Could anyone helpe me to make the below program work for VISTA? Any help is highly appreciated. Thanks
print STDERR "Split up datafile - JATD - 23/9/97\n"; print STDERR "This splits a long luminometer run into separate files, +one for each tube.\n"; print STDERR "Data for each tube should be preceeded by \'no 03\' etc. +\n"; print STDERR "Just drag your datafiles in turn onto the program icon,\ +n"; print STDERR "in the order in which they are to be processed.\n"; print STDERR "The program automatically appends data to existing files +,\n"; print STDERR "or creates new ones as needed.\n"; print STDERR "Files are placed in the same folder as the input files.\ +n\n"; $numargs=@ARGV; $state=0; $n=0; print STDERR "ARGV contained $numargs arguments.\n"; for ($m=0; $m<$numargs; $m++) { open (INFILE, $ARGV[$m]) || die "Couldn't open infile\n"; print STDERR "Opened file: $ARGV[$m]\n"; # establish path of infile @path=split(/:/,$ARGV[$m]); $pathlength=@path; $num= $path[$pathlength-1]; $path[$pathlength-1]=""; $root=join(":",@path); while (!(eof(INFILE))) { # get next record $n++; $i=<INFILE>; # does it contain text? if ($i =~ /[A-HJ-Za-z]/) { @array=split(/ /,$i); $arraylength=@array; $num= $array[$arraylength-1]; $array[$arraylength-1]=""; # close any existing file close (OUTFILE); if ($recnum) {print STDERR " - $recnum lines written.\n"; } # work out full pathname of the desired file $filename=join(" ",@array); $filename=~ s/[ ]+/ /g; if ($filename =~ /(no [0-9]+)/) { $filename = $1; } $file=$root; $file.= $filename; if (-e $file) { print STDERR "Adding to existing outfile: $file"; } else { print STDERR "Opening new outfile: $file"; } open (OUTFILE, ">>$file") || die "Couldn't open outfile\n"; $recnum=1; $i=$num; } $i =~ s/[ ]+/ /g; $recnum++; print OUTFILE $i; } # now at the end of the input # close any existing file close (OUTFILE); if ($recnum) {print STDERR " - $recnum lines written.\n"; } print STDERR "\nInput file contained $n records.\n"; } print STDERR "All finished.\n";
20100222 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How How to make mac written perl program to work in VISTA
by BrowserUk (Patriarch) on Feb 19, 2010 at 22:28 UTC | |
|
Re: How How to make mac written perl program to work in VISTA
by almut (Canon) on Feb 19, 2010 at 21:13 UTC | |
|
Re: How How to make mac written perl program to work in VISTA
by CountZero (Bishop) on Feb 19, 2010 at 21:42 UTC |