Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (/NAME:/){
- my @arr = /NAME:sS*sS*sS*/g or next;
- print "$_n" for @arr;
- }
- if (/NAME:/){
- my @arr = /NAME:sS*sS*sS*/g or next;
- print "$_n" for @arr;
- }
- my ($tmp) = /(?<=NAME: )(.*?)(?=s+DATE:)/g or next;
- my @arr = split(/,s+/, $tmp);
- use strict;
- use strict;
- use warnings;
- use autodie;
- use feature qw(say);
- use constant {
- TEXT_FILE => 'file.txt',
- NAME_LINE => qr/^NAME:s+/,
- };
- open my $name_fh, "<", TEXT_FILE; # Autodie eliminates need for testing if this worked
- while ( my $line = <DATA> ) {
- chomp $line;
- next unless $line =~ NAME_LINE; # Skip lines if they don't contain name
- ( my $name = $line ) =~ s/NAME:s+(.+?)s+DATE.*/$1/;
- say qq("$name");
- }
- close $name_fh;
- print join ": ", @foo . "n"; # Doesn't work.
- say join ": ", @foo; # This works fine.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement