Created
March 31, 2012 22:13
-
-
Save brunobuss/2269026 to your computer and use it in GitHub Desktop.
MTGO CSV Exporter Converter to MagicCards.info links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.10; | |
use strict; | |
use warnings; | |
my $fname = $ARGV[0]; | |
my $FHi, my $FHo; | |
open ($FHi, '<', $fname) or die $!; | |
open ($FHo, '>', $fname . '.out') or die $!; | |
while(<$FHi>){ | |
chomp; | |
if($_ =~ /^(?<qt>\d*)x\s(?<name>.*)$/){ | |
say $FHo $+{qt} . 'x <a href="http://magiccards.info/autocard.php?card=' . $+{name} . '" target="_blank">' . $+{name} . '</a>'; | |
} | |
elsif($_ =~ /^(?<qt>\d*),(?<name>.*)$/){ | |
say $FHo $+{qt} . 'x <a href="http://magiccards.info/autocard.php?card=' . $+{name} . '" target="_blank">' . $+{name} . '</a>'; | |
} | |
else{ | |
say $FHo $_; | |
} | |
} | |
close $FHi; | |
close $FHo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment