Re: converting a list into array

2002-09-04 Thread Bridget Benson
>Hi, > >I have a file with a list of symbols: > >AAPL >AMCO >IBM >ORCL > >I want to print like >'AAPL','AMCO','IBM''ORCL' > >Thanks for the help > >Sangeeta Maybe open (FILE, "$filename"); # READS in one line at a time ($_ contains all characters on that line) while () { print "$_, "; } >

Extracting bits out of a string of bytes

2002-09-04 Thread Bridget Benson
This is a response to last week's question on how to extract bits out of a string of bytes. Assume $packet is a string of 8 bytes. To extract the second byte: $second = unpack ('C', substr($packet, 1, 1)); To extract the last four bytes $last_four = unpack ('N', substr($packet, 4, 4)); To ext

Extracting bits from a string of bits

2002-08-29 Thread Bridget Benson
I am trying to grab selections of an ip packet stored in a string scalar. I know if you have a string of characters, you can change the string into an array of characters and then reference each character in the array. Can you do something similar with a string of bits? -- -- To unsubscribe

Net::RawIP module

2002-08-28 Thread Bridget Benson
I am having trouble using the Net::RawIP::dump function. I keep getting the error Bad filehandle for line 4 in this code. What is wrong with $fh? $p = open_offline($filename); $fh = dump_open($p, "file"); $packet = next($p, \%hdr); dump($fh, \%hdr, $packet); I understand this may not be a begi