in reply to Re^3: Addional "year" matching functionality in word matching script
in thread Addional "year" matching functionality in word matching script
I would have thought the &find_year ($title); would have taken the title and applied the subroutine to this string, picking out the 1989?#!/bin/perl open CSV3, "<csv3" or die; while (<CSV3>) { chomp; my ($title) = $_ =~ /^.+?,\s*([^,]+?),/; #/ match the title my %words; $words{$_}++ for split /\s+/, $title; #/ get words ## Collect unique words #+ # my @titlewords = keys(%words); + my @titlewords = keys(%words); #print "$title" } sub find_year { my( $str ) = @_; my $year; $year = $1 if( $str =~ /\b((?:19|20)\d\d)\b/ ); return $year } &find_year ($title);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Addional "year" matching functionality in word matching script
by Corion (Patriarch) on Jun 28, 2016 at 08:41 UTC | |
by bms9nmh (Novice) on Jun 28, 2016 at 14:06 UTC | |
by Corion (Patriarch) on Jun 28, 2016 at 14:17 UTC | |
by bms9nmh (Novice) on Jun 28, 2016 at 14:40 UTC | |
by Corion (Patriarch) on Jun 28, 2016 at 14:49 UTC | |
| |
|
Re^5: Addional "year" matching functionality in word matching script
by soonix (Chancellor) on Jun 28, 2016 at 08:52 UTC |