Printing to a file
From: Kevin Old (kevinold_at_gmail.com)
Date: 10/26/04
- Next message: Bob Showalter: "RE: MySQL+foreach loop.........roy"
- Previous message: Chris Devers: "RE: MySQL+foreach loop.........roy"
- Next in thread: JupiterHost.Net: "Re: Printing to a file"
- Reply: JupiterHost.Net: "Re: Printing to a file"
- Reply: Brian Gunlogson: "Re: Printing to a file"
- Reply: Gunnar Hjalmarsson: "Re: Printing to a file"
- Maybe reply: Bob Showalter: "RE: Printing to a file"
- Maybe reply: DBSMITH_at_OhioHealth.com: "Re: Printing to a file"
- Maybe reply: Ed Christian: "RE: Printing to a file"
- Maybe reply: DBSMITH_at_OhioHealth.com: "Re: Printing to a file"
- Maybe reply: Ed Christian: "RE: Printing to a file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 26 Oct 2004 11:38:25 -0400 To: beginners@perl.org
Hello everyone,
First, this is a basic problem, but I have looked at it for over an
hour and wasted time. Now, I'm asking for help.
For some reason nothing is being printed to the MY filehandle. Can
someone see what I'm doing wrong?
#!/usr/bin/perl
+
use warnings;
use strict;
use File::Find;
find sub {
return unless -f;
return unless $_ =~ /.\d+$/;
print "$_\n";
#print "$File::Find::name\n";
+
open(SD, "$_") or die "can't open $_ $!\n";
#my $fh = IO::File->new("> /tmp/savedata/new/$_") or die "Coul
+dn't open new for writing: $! \n";
open(MY, "> /tmp/savedata/new/$_") or die "can't open new $_ $
+!\n";
+
my @sd = <SD>;
foreach (@sd) {
if ( $_ =~ /40187378|40187233|40187230|4018722
+9|40187234|40187232|40186526/ ) {
#print "match: $_\n";
my $line = $_;
print MY $line;
}
}
+
close MY;
close SD;
}, ".";
Thanks,
Kevin
-- Kevin Old kevinold@gmail.com
- Next message: Bob Showalter: "RE: MySQL+foreach loop.........roy"
- Previous message: Chris Devers: "RE: MySQL+foreach loop.........roy"
- Next in thread: JupiterHost.Net: "Re: Printing to a file"
- Reply: JupiterHost.Net: "Re: Printing to a file"
- Reply: Brian Gunlogson: "Re: Printing to a file"
- Reply: Gunnar Hjalmarsson: "Re: Printing to a file"
- Maybe reply: Bob Showalter: "RE: Printing to a file"
- Maybe reply: DBSMITH_at_OhioHealth.com: "Re: Printing to a file"
- Maybe reply: Ed Christian: "RE: Printing to a file"
- Maybe reply: DBSMITH_at_OhioHealth.com: "Re: Printing to a file"
- Maybe reply: Ed Christian: "RE: Printing to a file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|