Generates the following warning msg. the line numbers correspond to the regex checks in the code block.#!/Perl/bin/perl -w use strict; use IO::File; use constant{KB => 2**10, MB => 2**20, GB => 2**30}; print "Enter the pathname and filename of the file to split: "; my $filename = <STDIN>; 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 = <STDIN>; chomp($block_size); $block_size =~ m{([a-zA-Z]{2}$)}; $block_type = $1; BLOCK_TYPE: { $block_type eq 'KB' && do{$block_type = KB; $valid_block_type = 1; last BLOCK_TYPE;}; $block_type eq 'MB' && do{$block_type = MB; $valid_block_type = 1; last BLOCK_TYPE;}; $block_type eq 'GB' && do{$block_type = GB; $valid_block_type = 1; last BLOCK_TYPE;}; DEFAULT_BLOCK_TYPE: {print "Invalid block type specified!\n\n" +;} } }
I understand that Perl wants me to decalre these strings in variables and reference them that way... but can someone explain why this is a bad practice?Use of uninitialized value in string eq at C:\Documents and Settings\x +xx\Desktop \deasm.pl line 32, <STDIN> line 3. Use of uninitialized value in string eq at C:\Documents and Settings\x +xx\Desktop \deasm.pl line 36, <STDIN> line 3. Use of uninitialized value in string eq at C:\Documents and Settings\x +xx\Desktop \deasm.pl line 40, <STDIN> line 3.
20030728 Edit by Corion: Retitled as per authors intention
In reply to why is this code bad under -w option? by Grygonos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |