#!/usr/bin/perl
use strict;
use warnings;
#coded by Daenyth
if (@ARGV < 2) { usage(); }
my $image = shift @ARGV;
my $archive = shift @ARGV;
my $type;
if ($image =~ /\.jpe?g$/) { $type = 'jpg'; }
elsif ($image =~ /\.png$/) { $type = 'png'; }
else { die "Error: Bad image filetype!\n"; }
if ($archive !~ /\.rar$/) { die "Error: Bad archive filetype!\n"; }
my $output = @ARGV ? shift @ARGV : 'Output.';
system "cat $image $archive > ${output}.${type}";
sub usage {
print "Usage: $0 Image.jpg Archive.rar [Output]\n";
print "Combine a jpg or png image with a rar archive.\n";
print "The output file will be created as an image of the same type as the input.\n";
print "Simply rename the output image to end in .rar and open it with your preferred archive utility.\n";
exit;
}