Skip to content

Instantly share code, notes, and snippets.

@brunobuss
Created March 31, 2012 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunobuss/2269026 to your computer and use it in GitHub Desktop.
Save brunobuss/2269026 to your computer and use it in GitHub Desktop.
MTGO CSV Exporter Converter to MagicCards.info links
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