[EMAIL PROTECTED] wrote:
> 
> All,

Hello,

> I am having some trouble figuring this out.  I want to enter some text
> within a pre-existing file.  Here is what the file would look like
> 
> E00140
> E00141
> E00143
> .
> .
> .
> 
> here is my code thus far
> 
> #!/usr/local/bin/perl -w
> use strict;
> my $ejectapes = "/usr/local/bin/perld/exports";
> open (ACSLS, "$ejectapes") || die "cannot open file ejectapes \n: $!";
> while (defined($ejectapes = <>)) {
> print "eject", "\t", "0,0,0", "\t", "\n", $_;
> close (ACSLS);
> }
> 
> I want to print eject 0,0,0 before the tapeid

You can either use Perl's "in-place" edit feature or use a second file
to write the data to.  Using in-place edit would look something like
this:

#!/usr/local/bin/perl -w
use strict;
( $^I, @ARGV ) = ( '', '/usr/local/bin/perld/exports' );

s/^(?=E\d{5})/eject\t0,0,0\t\n/ while <>;




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to