On Jan 21, 2006, at 21:43, Bowen, Bruce wrote:
> Perhaps that file has mixed newline conventions? Does
>
> $entire_file_content =~ tr/\015\012//d;
>
> do what you need?
>
> -- fxn
>
> That did not work. I've looked into the file with a hex editor it
> that's telling me there's a
> hex 0D 0A 0D 0A after each |FS. I've tried all of the combinations
> I can think of, none of which had any effect. The process seems to
> work up to the first time it gets to that hex data.
Looks like you've got a bug or some wrong assumption, would you
please send the code?
-- fxn
use warnings;
# Root directory...
my $rootdir = "C:\\diebold\\ddc2005\\";
# Get all the arguments and determine the number of arguments...
my @args = @ARGV;
my $args = @args;
my $source = $args[0];
$/ = "";
opendir DH, "C:\\diebold\\ddc2005\\hooks\\";
open SCREEN, "C:\\diebold\\ddc2005\\hooks\\".$source;
$SCREEN = <SCREEN>;
$SCREEN =~ s/\n//g;
$SCREEN =~ s/\r//g;
my $ds_in = index($SCREEN, "\|DS");
$SCREEN = substr($SCREEN, $ds_in+3);
@screens = split/\|FS/, $SCREEN;
my $count = @screens;
for ($i = 0; $i < $count; $i++)
{
my $SCR = substr($screens[$i], 0, 3);
my $DIR = substr($screens[$i], 7, 3);
#print "DIR = ", $DIR, "\n", "SCR = ", $SCR, "\n";
my $text = substr($screens[$i], 4);
open FILE, "> C:\\diebold\\ddc2005\\Lang".$DIR."\\SCR".$SCR.".TXT" or die;
#print "scr = ", $SCR, "\n", $screens[$i], "\n", "I = ", $i, "\n";
print (FILE $text);
}
close DH;
exit;
Code and file.
Bruce
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Swipe.msc
Description: Swipe.msc
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
