FYI...I was able to execute your code successfully
with a ten-thousand line file. A diff between the two
files displays the expected results.
If this is just a snippet, perhaps your problem lies
elsewhere within the script?
--- [EMAIL PROTECTED] wrote:
> Here is a code snippet that I wrote for this
> procedure but for some reason the source file seems
> to disappear on files with 4000+ lines. Just trying
> to isolate the problem. Does anyone recommend a
> better way for this procedure?
>
> open(SOURCE, "< $SOURCEFILE")
> or die "\n***** Could not open specified
> source file $SOURCEFILE: $!\n";
> my $TEMPFILE=$SOURCEFILE . '_tmp';
>
> open(TEMP, "> $TEMPFILE") or die "Could not open
> tempfile $TEMPFILE: $!";
>
> while (<SOURCE>) {
> unless ($. == 1) {
> (print TEMP $_) or die "\n***** Could
> not write to tempfile $TEMPFILE: $!";
> }
> }
>
> close(SOURCE) or die "Can't close source file
> $SOURCEFILE: $!";
> close(TEMP) or die "Can't close tempile $TEMPFILE:
> $!";
>
> > Mario,
>
> Sure there is a better way, but
>
> with
>
> s/(\w+)\./$1_/g # All dots to underscores
>
> you get
>
> abc_def_ghi_jkl_mno
>
> then, with
>
> s/_(\w[^_]+)$/_\.$1/ # the last underscore to
> "_."
>
> you get
>
> abc_def_ghi_jkl_.mno
>
>
>
> Antonio
>
> El 27-may-04, a las 13:49, mario sanchez escribi�:
>
> > help for a novice (going crazy)
> >
> > i cant seem to find the sequence to substitute all
> "." with "_" EXCEPT
> > for
> > the last one
> >
> > ex. change abc.def.ghi.jkl.mno
> > to abc_def_ghi_jkl_.mno
> >
> > any help or pointers please?
> > thank you
> > mario
> >
> > _______________________________________________
> > Perl-Unix-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> >
> > _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> > _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs