Barbara Manfredini wrote: > > I have some little problems: > If I have a file,how can I say to cut a line where my pattern is matched? > And how can I cut just the word or what is matched? > How can I take just what is after the @ symbol(to know the dominion > contained in my file) to put it in an hashh ()to take each dominion one > time) ?
#!/usr/bin/perl use warnings; use strict; my $file_in = '/home/barbara/somefile.txt'; my $file_out = '/home/barbara/new_file.txt'; open IN, '<', $file_in or die "Cannot open $file_in: $!"; open OUT, '>', $file_out or die "Cannot open $file_out: $!"; my %hashh; while ( <IN> ) { # cut a line where my pattern is matched next if /pattern/; # cut just the word or what is matched s/pattern//; # take just what is after the @ symbol(to know the dominion # contained in my file) to put it in a hashh if ( /\@(.*)/ ) { $hashh{$1}++; } print OUT; } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]