#!/usr/bin/perl -w use strict; use IO::File; my %multipliers = ( 'KB' => 2**10, 'MB' => 2**20, 'GB' => 2**30, ); print "Enter the pathname and filename of the file to split: "; my $filename = ; my $valid_block_type; my $block_size; my $block_type; until($valid_block_type) { print "Enter the block size \n (example: 400KB,10MB,1GB): "; $block_size = ; chomp($block_size); ($block_type) = ($block_size =~ m/([a-zA-Z]{2})$/); $block_type ||= 'KB'; $block_type = uc $block_type; if( grep($block_type eq $_, keys %multipliers) ) { $block_type = $multipliers{$block_type}; $valid_block_type = 1; } else { print "Invalid block type specified!\n\n"; } }