Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to extract Name and No from .vcf file.

by vinoth.ree (Monsignor)
on Aug 03, 2015 at 05:49 UTC ( [id://1137212]=note: print w/replies, xml ) Need Help??


in reply to How to extract Name and No from .vcf file.

use strict; use warnings; my $filename = $ARGV[0]; my ($name, $number); open my $fh, "<", "$filename" or die "$!"; open my $fh2, ">", "list.txt" or die "$!"; my @matches=(); while(my $line = <$fh>) { if (grep { $line =~ $_ } qr/^\s*FN/, qr/\s*TEL/){ if( $line =~ /^\s*FN:(.*)/ ) { push(@matches,$1); } elsif( $line =~ /^\s*TEL;TYPE=CELL;TYPE=PREF:(.*)/ ) { push(@matches , $1); } } else{ next; } } print $fh2 "@matches" ; close $fh2 or die "$!"; close $fh or die "$!";

All is well. I learn by answering your questions...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1137212]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-19 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found