Paul Archer wrote:
> (As I noted in an earlier post) I'm writing a handler for an LCD
> display (a BPP-440 from Scott Edwards (www.seetron.com)). The
> display is 4 lines x 40 characters, and has direct cursor
> positioning.
> I'm going to store the data for several virtual screens, but I
> don't know whether it would be better (in terms of speed and
> writing/maintaining the code) to use an array with 160 elements
> (one for each character), or a single scalar with 160 characters.
> It seems to me that if I use a scalar I can use perl's string
> manipulation tools, and if I use arrays I can use slices--but I
> have no idea if one is going to have any significant
> advantages/disadvantages over the other.

Forget about speed until you find it's too slow. Write it the most
obvious way, which depends on what operations you need to perform
on the device. In the end it would be nice to write a module for it
- maybe a subclass of IO::Handle so that you can do

  use Device;
  my $display = new Device;
  $display->print "line1\nline2\nline3";

but in the meantime my first bet would be an array of four
scalar strings.

HTH,

Rob






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to