CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
How How to make mac written perl program to work in VISTA

 



venkatc
New User

Feb 19, 2010, 12:35 PM

Post #1 of 4 (5936 views)
How How to make mac written perl program to work in VISTA Can't Post

I have a perl program which was written in mac perl 1997. But when I run this program in VISTA its not giving an output as I wanted.

Could please anyone help me in this?

Any help will be highly appreciated.

Thank you, J


FishMonger
Veteran / Moderator

Feb 19, 2010, 12:43 PM

Post #2 of 4 (5934 views)
Re: [venkatc] How How to make mac written perl program to work in VISTA [In reply to] Can't Post

Impossible to help without seeing the code.


venkatc
New User

Feb 19, 2010, 12:51 PM

Post #3 of 4 (5931 views)
Re: [FishMonger] How How to make mac written perl program to work in VISTA [In reply to] Can't Post

Thank you very much for your quick reply. Here is the code that is not working in VISTA and which was written for Mac. 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";


FishMonger
Veteran / Moderator

Feb 19, 2010, 1:32 PM

Post #4 of 4 (5920 views)
Re: [venkatc] How How to make mac written perl program to work in VISTA [In reply to] Can't Post

Always use the code tags when posting your code.


Quote
Here is the code that is not working in VISTA

That is meaningless. Please explain what is not working.

What is the script doing that it shouldn't?

What is it not doing that it should?

Add this to near beginning.

Code
use warnings;

What warnings/errors does it produce?

Does the script fail to open the file(s)?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives