my $cmd = "/usr/sbin/fdisk -c $device"; open my $fdisk, "| $cmd" or die "Couldn't spawn [$cmd]: $!"; for my $command ("n", "p", "1", "1", "+G", "t", "83", "w") { print $fdisk "$command\n"; };