Skip to content

Instantly share code, notes, and snippets.

@takus
Created October 9, 2011 14:37
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 takus/1273760 to your computer and use it in GitHub Desktop.
Save takus/1273760 to your computer and use it in GitHub Desktop.
Create temp file from existing file
#!/usr/bin/env perl
use strict;
use warnings;
use File::Temp;
use File::Copy;
my $origin_file = shift;
my $tmpfile = File::Temp->new(UNLINK => 0, SUFFIX => '.suffix');
copy($origin_file, $tmpfile) or die "copy failed: $!";
print "$tmpfile is created\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment