use strict; use warnings; use Devel::Size qw(size); my $str = ''; for (1 .. 1_000_000) { $str .= "x" x 80; } print "ASCII string has @{[ length($str) ]} characters and consumes @{[ size($str) ]} bytes\n"; $str = ''; for (1 .. 1_000_000) { $str .= "\N{U+1234}" x 80; } print "Unicode string has @{[ length($str) ]} characters and consumes @{[ size($str) ]} bytes\n";