Hey Jeff, Thanks for responding :) > >The source file is available at www.chebucto.ns.ca/~aw096/bin2asc.pl > >Take a look and let me know what you think, what I did that was stupid > >and/or counterproductive. Also, if you think it's neat. > > #!/usr/bin/perl -l > > chomp($string = <STDIN>); > $asBinary = asc2bin($string); > $asASCII = bin2asc($asBinary); > > sub asc2bin { > my ($str) = @_; > my @bytes; > for (split //, $string) { > vec(my($byte), 0, 8) = ord; > push @bytes, unpack "B8", $byte; > } > return wantarray ? @bytes : join " ", @bytes; > } I don't understand what this does. I mean, as a little black box, I understand it. But I try to keep the people who use little black boxes in my office restricted to my boss :) > for (split //, $string) { I didn't know you could do this. :) Neat! (I'm kicking myself for not having it occur without having to see it.) > vec(my($byte), 0, 8) = ord; > push @bytes, unpack "B8", $byte; I honestly don't know. > } > return wantarray ? @bytes : join " ", @bytes; Same here. I'm used to returning like return($item1,@item2); ( etc ) What's the wantarray ? @bytes : join " " line do? is that the same as my $item1 = join(" ", @bytes); return($item1); ?? :) Thank you, Joey. > -- > MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve japhy@pobox.com > http://www.pobox.com/~japhy/ http://pinyaj.stu.rpi.edu/ > PerlMonth - An Online Perl Magazine http://www.perlmonth.com/ > The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/ > ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe