Hi,

For the following keys, I wish the values to be the abbreviation of them,

Nat. Neurosci.
Expert Reviews in Molecular Medicine.
Intermolecular Forces
Nature Cell Biol.
CNS Neurol Disord Drug Targets
Nat. Rev. Mol. Cell Biol.

I came up one, not working though,


#!/usr/bin/env perl

use strict;
use warnings;
use autodie qw(open close);
use 5.012;


open my $fh, '<', "try.txt";

my %abbrev;
my @abbre;
while(my $line = <$fh>){
        if (/([[:upper:]]).*([A-Z]).*?([A-Z])+?/){
                print $1,$2;
                print $3,"\n" if defined $3  ## Here is a mess. I don't know 
how to handle it
                $abbre[]=join '',$1,$2,$3;
                $abbrev{$line} = $abbre;
        }
}

Best regards,

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to