in reply to Re: Alternative to substr on unknown length of scalar
in thread Alternative to substr on unknown length of scalar
use strict; use warnings; use diagnostics; my $line = 'a'x 8; my $prnline = sprintf("len(line) > 6: [%-6s]\n",$line); $line = 'b' x 6; $prnline .= sprintf("len(line) = 6: [%-6s]\n",$line); $line = 'c' x 3; $prnline .=sprintf("len(line) n 6: [%-6s]\n",$line); print $prnline; __END__ len(line) > 6: [aaaaaaaa] len(line) = 6: [bbbbbb] len(line) n 6: [ccc ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Alternative to substr on unknown length of scalar
by thospel (Hermit) on Oct 19, 2004 at 15:04 UTC | |
by periapt (Hermit) on Oct 20, 2004 at 20:09 UTC |