From: J�rgen Exner on 4 Mar 2010 13:18 Don Pich <dpich(a)polartel.com> wrote: [...]>while ($line = <$INFILE>) { > my($IP) = split /\t/, $line; > foreach my $val (@value) { [...] >But it doesn't run because of: > >Global symbol "@value" requires explicit package name at ./convertX.pl >line 12. Well, yeah, you never declared nor defined @value. What is that array supposed to be? jue
From: J�rgen Exner on 4 Mar 2010 13:23 Don Pich <dpich(a)polartel.com> wrote: >while ($line = <$INFILE>) { > my(@IP) = split /\t/, $line; ???? You are confusing me. According to your sample data each line contains IP, address, name, MAC and a whole jumbalaja of other stuff. Why are you putting all of that into an array names @IP? > foreach my $val (@IP) { > $val = sprintf("%02x", $val); And why are you trying to format the address, name, MAC, ... as hex values? >Source File (snippet): >10.20.150.252 STTM.12.01 BAS-ADSL16R 00:0A:9F:40:71:D3 >3.2.1.28 >10.20.150.250 STTM.13.01 BAS-ADSL16R 00:0A:9F:40:71:DF >3.2.1.28 jue
From: ccc31807 on 4 Mar 2010 13:33 On Mar 4, 1:14 pm, s...(a)netherlands.com wrote: > Without it, you don't know where a valid end of the IP string is. What about EOF? Surely a line not terminated by a newline but followed by an EOF has a valid ending. CC
From: J�rgen Exner on 4 Mar 2010 13:43 ccc31807 <cartercc(a)gmail.com> wrote: >On Mar 4, 1:14�pm, s...(a)netherlands.com wrote: >> Without it, you don't know where a valid end of the IP string is. > >What about EOF? Surely a line not terminated by a newline but followed >by an EOF has a valid ending. Actually there are many people who would argue that a 'line' without a trailing newline (EOL) isn't a line at all but garbage at the end of the file after the end of the preceeding line. jue
From: Don Pich on 4 Mar 2010 13:54 You know what? My completely ugly script actually did what it was supposed to. This was a one time shot and probably will not have to run this again in the near future. So I think I will call off the hunt on getting this going. I'm VERY new at trying to use Perl. I've used other programing languages before. But I'm definitely in my infancy at trying to understand. If I post to this forum again, I will try to be more specific as not to cause confusion. Thanks to all who helped me as far as they did!!!
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: FAQ 4.65 How can I get the unique keys from two hashes? Next: FAQ 7.13 What's a closure? |