Skip to content

Instantly share code, notes, and snippets.

@ytnobody
Created Jan 23, 2014
Embed
What would you like to do?
export env args
#!/usr/bin/env perl
use strict;
use warnings;
my $dir = $ARGV[0] || 'env';
mkdir $dir unless -d $dir;
my @data = `env`;
chdir $dir;
for my $entry (@data) {
chomp $entry;
my ($name, $val) = split('=', $entry, 2);
open my $fh, '>', $name or die $!;
print $fh $val;
close $fh;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment