http://www.perlmonks.org?node_id=984562


in reply to Get size and bitrate of video with perl and ffmpeg

while (<FILE>) { my $line = $_;

That is usually written as:

while (my $line = <FILE>) {


my @vsize = split (' ', trim ($pieces[2])); my @vbits = split (' ', trim ($pieces[3])); my $video_size = trim (shift @vsize); my $video_bits = trim (shift @vbits);

split ' ' removes ALL whitespace so the use of the trim function is superfluous.

my ( $video_size ) = split ' ', $pieces[ 2 ]; my ( $video_bits ) = split ' ', $pieces[ 3 ]