Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my $progName = shift ;
- open(IPLAYERLIST, "iplayer-list.html") or die "Cannot open iplayer index file iplayer-list.htmln" ;
- while (<IPLAYERLIST>) {
- if ( /($progName)/is ) {
- #if ( /Just A Minute/is ) { <-- This works!
- my $iplayerID = $1 ;
- print "IPlayer program id for $progName is $iplayerIDn" ;
- # === do stuff here ===
- }
- else
- {
- print "Failed to match $progName in $_n";
- }
- }
- #!/usr/bin/perl
- use strict ;
- my $searchstr = "foo bar Just A Minute baz boo" ;
- my $progName = $ARGV[0] ;
- print "searching for [$progName] in [$searchstr]n" ;
- if ( $searchstr =~ /$progName/is ) {
- print "Well the test workedn" ;
- } else {
- print "Failed to match [$progName] in [$searchstr]n";
- }
- Foo
- Just A Minute
- Bar
- Failed to match Just A Minute in Foo
- IPlayer program id for Just A Minute is Just A Minute
- Failed to match Just A Minute in Bar
- my $progName = shift ;
- open(IPLAYERLIST, "list.txt") or die "Cannot open iplayer index filen" ;
- while (<IPLAYERLIST>) {
- if ( /($progName)/is ) {
- #if ( /Just A Minute/is ) { <-- This works!
- my $iplayerID = $1 ;
- print "IPlayer program id for $progName is $iplayerIDn" ;
- # === do stuff here ===
- }
- else
- {
- print "Failed to match $progName in $_n";
- }
- }
- egg
- spam
- foo bar Just A Minute baz boo
- egg spam Just A Minute spam egg
- foo
- bar
- Failed to match just a minute in egg
- Failed to match just a minute in spam
- IPlayer program id for just a minute is Just A Minute
- IPlayer program id for just a minute is Just A Minute
- Failed to match just a minute in foo
- Failed to match just a minute in bar
- Just A Minute (extra spaces)
- Just
- A
- Minute
- Just <!--comment-->A Minute
- Just[the nbsp entity]A Minute
Add Comment
Please, Sign In to add comment