0

I recently upgraded a 32-bit Debian server to 64-bit by re-installing, and copying my data into place.

After this I have a perl script that repeats the following, and is segfaulting on the tell line:

seek(FIN,$ps,0);
tell(FIN, $ps);
$line=<FIN>;

I don't speak perl, so I'm not sure exactly what is going on here. I can get the script to run (apparently successfully) by commenting every occurrence of tell, but this is obviously not the best solution.

I suspect that tell is calling a 32-bit binary or something, and that is the cause of the segfault - but I don't know.

Can someone explain what tell does, and if it is indeed a separate binary, what package it belongs to (or how it is installed ie. cpan)?

Or perhaps I am on the wrong track?

Jim B
  • 23,938
  • 4
  • 35
  • 58
Brent
  • 22,219
  • 19
  • 68
  • 102

3 Answers3

1

According to the Perl docs at http://perldoc.perl.org/functions/tell.html, tell has only one parameter and returns the current position. Your code has two parameters. Try this instead:

$ps = tell(FIN);

There should also be some error checking in case tell returns -1, which indicates an error.

Brian Showalter
  • 1,029
  • 9
  • 13
  • but he's just seek'd to $ps.. so that seems a waste of time? Think we need more context. What's the script? What is it supposed to do? Are you able to post it someplace? – Tom Newton May 08 '10 at 13:56
0

It is a built-in function, but a segfault is a pretty harsh way for a perl script to die (this has never happened to me), so I have no clue what could be the cause.

Sven
  • 97,248
  • 13
  • 177
  • 225
0

To answer your direct question, tell returns the current position of a filehandle.

gorilla
  • 1,207
  • 9
  • 6