Regex Issue

2007-08-28 Thread Dharshana Eswaran
Hi All, I have written a program, use strict; use warnings; my $Enum = "typedef enum _SIGNAL_E { LEVEL_0_EV = 0, LEVEL_1_EV, LEVEL_2_EV, LEVEL_3_EV, LEVEL_4_EV, LEVEL_5_EV } SIGNAL_E;"; my $Enumidentifier = qr{ [A-Z0-9_]\w* }xs; my $Enumstatement = qr{ \s*

Re: Doubt on Pattern Matching

2007-08-28 Thread Dharshana Eswaran
On 8/28/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/28/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > > When i write the condition > > my @m = $fullStruct =~ /$DLstatement/g; > > and try printing the array, > > print "\nThe ar

Re: Doubt on Pattern Matching

2007-08-27 Thread Dharshana Eswaran
When i write the condition my @m = $fullStruct =~ /$DLstatement/g; and try printing the array, print "\nThe array is @m\n"; It prints nothing This is the problem... Thanks and Regards, Dharshana On 8/28/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/28

Doubt on Pattern Matching

2007-08-27 Thread Dharshana Eswaran
Hi All, I have a pattern, which reads as shown below: my $comment= qr{\s* (?:/\* .*? \*/ \s*)*}xs; my $identifier = qr{ [A-Za-z_]\w* }xs; my $statement = qr{ \s* ($identifier) \s+ ($identifier) \s*

Re: String Manipulation

2007-07-31 Thread Dharshana Eswaran
, only when i work, i m getting to know more on the language. And I really thank the whole group for helping each other in learning Perl. Thanks and Regards, Dharshana On 7/31/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > > On Jul 31, 8:40 am, [EMAIL PROTECTED] (Dharshana Eswaran) wrote:

Re: String Manipulation

2007-07-31 Thread Dharshana Eswaran
> > > -Original Message- > From: Dharshana Eswaran [mailto:[EMAIL PROTECTED] > Sent: 31 July 2007 13:17 > To: Perl Beginners > Subject: String Manipulation > > Hi All, > > I have a string which reads > $str5 = "DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep t

String Manipulation

2007-07-31 Thread Dharshana Eswaran
Hi All, I have a string which reads $str5 = "DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep the adjacent ones consecutive */"; Here i need to consider the variable and its value, ignoring the comment. I have a pattern which reads if($str5 =~ /\s*([A-Z_]+)\s=\s(\w+),*/) { print "$1 and $2\n";

Re: String Manipulation

2007-06-28 Thread Dharshana Eswaran
Thank you. But i am unable to understand the working of the code which you have written. Can you please explain it? Thanks and Regards, Dharshana On 6/28/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > On 6/28/07, Tom

Re: String Manipulation

2007-06-27 Thread Dharshana Eswaran
On 6/28/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > I am unable to get a generalised way in which it can extract them as few > structures have comments, few does not hav comments etc. Does the data have some def

String Manipulation

2007-06-27 Thread Dharshana Eswaran
Hi All, I have a string in which structures are stored. Each time i read a file, different structure in stored in the string. The different possible structures stored in the string is as shown: $string = "{ STACK_CC_SS_COMMON_TYPE_REFERENCE_ID_Tpp_reference_id; STACK_CC_SS_COMMON_TYPE_

Re: Regarding file handling

2007-06-21 Thread Dharshana Eswaran
SS_COMMON_TYPE_CHANNEL_TYPE_T => "UINT8", STACK_CC_SS_COMMON_TYPE_CHANNEL_MODE_T => "UINT8", STACK_CC_SS_COMMON_TYPE_CHANNEL_MODE_T => "UINT8", STACK_REG_COMMON_TYPE_RAB_ID_T => "UINT8", But without repetitions Thanks and Regards, Dharshana On 6/2

Re: Regarding file handling

2007-06-21 Thread Dharshana Eswaran
unable to check the duplicate copies. That is, if the same primitive is passed again and again, my code just gets the structure and stores it multiple times. I want it to store only once. That is the problem. I hope this describes the problem to all. I kindly request you to guide me in this. Than

Re: Regarding file handling

2007-06-21 Thread Dharshana Eswaran
On 6/21/07, Paul Lalli <[EMAIL PROTECTED]> wrote: On Jun 21, 9:31 am, [EMAIL PROTECTED] (Dharshana Eswaran) wrote: > Hi All, > > I am reading a certain data from one file and writing to another file. In > the original file, there are few lines, which occur more than once in

Regarding file handling

2007-06-21 Thread Dharshana Eswaran
Hi All, I am reading a certain data from one file and writing to another file. In the original file, there are few lines, which occur more than once in different lines. When i am writing it to the second file, i don't want it to be written more than once. I mean, it should not be repetitive. The

Regarding pattern matching

2007-05-24 Thread Dharshana Eswaran
Hi All, I am trying to extract strings from few files. The content of the file reads as shown typedef struct { REFID_T pp_ref_id; /* destination */ CAUSE_T pp_cause;/* Reason registered */ STATE_T pp_state; /* State for indicators */ COMMON_TY

Re: Regarding files

2007-05-21 Thread Dharshana Eswaran
Keeping the classic (state machine) approach in mid, i tried writing a logic for the same But i am not able to retrieve the lines accurately, Can you please help me with a small piece of code for the same logic which you mentioned? On 5/21/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: &quo

Re: Regarding files

2007-05-21 Thread Dharshana Eswaran
Thank you all.. But i dont want to use any perl modules in the code. I am trying to get a logic without any help from the additional modules. Thanks and Regards, Dharshana On 5/21/07, Mumia W. <[EMAIL PROTECTED]> wrote: On 05/20/2007 11:37 PM, Dharshana Eswaran wrote: > Hi All, >

Regarding files

2007-05-20 Thread Dharshana Eswaran
Hi All, The below code helps in reading a file in reverse: use strict; use warning; open( FILE, "<$file_to_reverse" ) or die( "Can't open file file_to_reverse: $!" ); @lines = reverse ; foreach $line (@lines) { # do something with $line } But i am trying to grep for a string in the file an

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
_T */'; my @parts = $string =~ m/\s+?(\w+)\s+?\((\w+.*?)\)[EMAIL PROTECTED](\w+).*/; #use Data::Dumper; #print Dumper @parts; print $1 . "\n" . $2 . "\n" . $3 . "\n"; print "#- or -#\n"; foreach ( @parts ) { print $_ . "\n"; } On 5

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
use Data::Dumper; > > print Dumper @parts; > > - Had to change that one \S to \s (oops) - > > OUTPUT > - > $VAR1 = 'NSS_FACILITY_IND_ID'; > $VAR2 = 'TF_MNSS_MESSAGE_CATEGORY + 0x01'; > $VAR3

Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
Hi All, I am trying to extract few strings from a text file. The pattern of the text stored in the file is as follows: #define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */ I need to extract MNSS_FACILITY_IND_ID, TF_MNSS_MESSAGE_CATEGORY + 0x01 and MNSS

Regarding perl/tk programming

2007-05-15 Thread Dharshana Eswaran
Hi All, I need to create a GUI and integrate my perl script to it. I decided to get the GUI using perl/Tk programming. I searched in the net and i am unable to get a good tutorial or any document regarding the perl/Tk programming. If anyone knows any links or have any documents, can you please m

Re: Query in pack and unpack functions

2007-05-03 Thread Dharshana Eswaran
Thank you Dr.Ruud. It solved my problem. :-) Thanks and Regards, Dharshana On 5/3/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: "Dharshana Eswaran" schreef: > $input = 23; #any decimal value > $hex1 = sprintf ("%x",$input); > $binary = unpack 'B*'

Query in pack and unpack functions

2007-05-03 Thread Dharshana Eswaran
Hi All, My aim is to supply a hexadecimal value and print its binary value. I have written a small piece of code for the same: $input = 23; #any decimal value $hex1 = sprintf ("%x",$input); $binary = unpack 'B*', pack 'H*', $hex1; @fields1 = unpack 'A4A4', $binary; print "$fields1[1] $fie

Re: Accessing packed data structures

2007-03-13 Thread Dharshana Eswaran
On 3/14/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 3/14/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: snip > Now how do i come up with the pack template? I dont know how a enum should > be represented in the pack template. :-( > > /I8(enum)I8i8I8/ => pack templ

Re: Accessing packed data structures

2007-03-13 Thread Dharshana Eswaran
On 3/13/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 3/13/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > I was going thro the topic "Accessing packed data structures" in the Perl > Complete Reference Book. I came across this example: > > struct utmp { >

Accessing packed data structures

2007-03-13 Thread Dharshana Eswaran
Hi all, I was going thro the topic "Accessing packed data structures" in the Perl Complete Reference Book. I came across this example: struct utmp { char ut_user[8]; /* User login name */ char ut_id[4]; /* /etc/inittab id */ char ut_line[12]; /* device name */ short ut_pid; /* process ID */ shor

Re: Query on pattern matching

2007-03-08 Thread Dharshana Eswaran
On 3/9/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Chas Owens wrote: > On 3/8/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: >> >> I need to extract few strings from one file and paste it to another file. > snip > > This doesn't seem like a good job

Query on pattern matching

2007-03-08 Thread Dharshana Eswaran
Hi all, I need to extract few strings from one file and paste it to another file. My source file, i.e., my .h file, contains statements like: #define GMMREG_ATTACH_REQ_ID (GMMREG_PRIM_ID_BASE) /* @LOG GMMREG_ATTACH_REQ */ #define GMMREG_DETACH_REQ_ID (GMMREG_PR

Re: Working with files

2007-02-22 Thread Dharshana Eswaran
On 2/22/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: Hello All, I need to search a particular string in a set of files in a directory. The string appears only in one of the files in the directory. I need to retrieve the file name and then access the line of that particular file in

Working with files

2007-02-22 Thread Dharshana Eswaran
Hello All, I need to search a particular string in a set of files in a directory. The string appears only in one of the files in the directory. I need to retrieve the file name and then access the line of that particular file in which the string occurs. NOTE: The perl script also resides in the

Re: Pattern matching

2007-02-21 Thread Dharshana Eswaran
On 2/21/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: On 2/21/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: > > "Dharshana Eswaran" schreef: > > > TAPI_VOICE_NOTIFY_OTHERAPP_JOINING_MSGID > > TAPI_TTY_NOTIFY_TTY_TONE_MSGID > > [...] > > C

Re: Pattern matching

2007-02-21 Thread Dharshana Eswaran
On 2/21/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: "Dharshana Eswaran" schreef: > TAPI_VOICE_NOTIFY_OTHERAPP_JOINING_MSGID > TAPI_TTY_NOTIFY_TTY_TONE_MSGID > [...] > Can anyone help me in getting a generalised pattern from these? m/^ TAPI (?:_[A-Z]+)+ $/x -- Affijn,

Pattern matching

2007-02-20 Thread Dharshana Eswaran
Hello All, I have quite a number of strings which has some typical matches between them. I am unable to come up with a generalised pattern for them. Few among those strings are like this: TAPI_VOICE_NOTIFY_OTHERAPP_JOINING_MSGID TAPI_TTY_NOTIFY_TTY_TONE_MSGID TAPI_NOTIFY_CALL_LINE_INFO_MSGID TA

Re: Is there any way to use C header files in perl program?

2007-02-20 Thread Dharshana Eswaran
On 2/20/07, Peter Scott <[EMAIL PROTECTED]> wrote: On Tue, 20 Feb 2007 12:19:22 +0530, Dharshana Eswaran wrote: > Hello All, > > I need to use a C header file in Perl program in Unix. > > Is it possible to use the header files from perl in any way? I do not want > to

Is there any way to use C header files in perl program?

2007-02-19 Thread Dharshana Eswaran
Hello All, I need to use a C header file in Perl program in Unix. Is it possible to use the header files from perl in any way? I do not want to use any modules for the same. I do not want to enable the perl program to call a routine in C library through XS. I just want to use the values rather

Re: Pattern Matching

2007-01-21 Thread Dharshana Eswaran
On 1/19/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Dharshana Eswaran wrote: > Hi All, Hello, > I have a string as shown below: > > $string = > "{[0]=0x53,[1]=0x65,[2]=0x63,[3]=0x75,[4]=0x72,[5]=0x69,[6]=0x74,[7]=0x79,[8]=0x43,[9]=0x6F,[10]=0x64,[11]=0x65,[12]=0x00

Re: Pattern Matching

2007-01-21 Thread Dharshana Eswaran
On 1/19/07, Rob Dixon <[EMAIL PROTECTED]> wrote: Igor Sutton wrote: > I have an update: > >> my @data = $string =~ m/0x(\d{2})/g; > > my @data = $string =~ m/0x(\S{2}),?/g; > > Now I think it is right :) my @data = $string =~ m/=0x(..)/g; :) Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] F

Re: Pattern Matching

2007-01-21 Thread Dharshana Eswaran
On 1/19/07, Igor Sutton <[EMAIL PROTECTED]> wrote: I have an update: > my @data = $string =~ m/0x(\d{2})/g; my @data = $string =~ m/0x(\S{2}),?/g; Now I think it is right :) -- Igor Sutton Lopes <[EMAIL PROTECTED]> I used the above expression and it worked for me. Thanks you so much. Tha

Pattern Matching

2007-01-19 Thread Dharshana Eswaran
Hi All, I have a string as shown below: $string = "{[0]=0x53,[1]=0x65,[2]=0x63,[3]=0x75,[4]=0x72,[5]=0x69,[6]=0x74,[7]=0x79,[8]=0x43,[9]=0x6F,[10]=0x64,[11]=0x65,[12]=0x00}" This is stored as a string in a variable. I need to pull out only the numbers and store them in a array. Like: @array =

Re: Calling a perl program from a perl script

2007-01-10 Thread Dharshana Eswaran
On 1/11/07, Jeff Pang <[EMAIL PROTECTED]> wrote: >I Have a perl program which runs successfully and gets the required output. > >I need to call that program from a perl script. I tried this using eval >function. But it failed. > > Can i know how to do this? > >Can anyone guide me in this? > It

Calling a perl program from a perl script

2007-01-10 Thread Dharshana Eswaran
Hi All, I Have a perl program which runs successfully and gets the required output. I need to call that program from a perl script. I tried this using eval function. But it failed. Can i know how to do this? Can anyone guide me in this? Thanks and Regards, Dharshana

Reversing Digits

2007-01-08 Thread Dharshana Eswaran
Hi all, I was trying to reverse the digits. For eg: if i have 50, i wanted to print 05 Can anyone tell me a simple way? Thanks and Regards, Dharshana

Ragarding regular expression

2007-01-04 Thread Dharshana Eswaran
Hi, I have an array which reads as follows: @array = (01, 45, 02, 57, 03); When i try to print this array, it prints the single digit value as 1, 45, 2, 57, 3 But i want it to print like 01, 45, 02, 57, 03 I can use if condition and then try printing the value as double digit, but i was t

Re: Syswrite Function in Perl

2007-01-02 Thread Dharshana Eswaran
On 1/3/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Dharshana Eswaran wrote: > Hi All, Hello, > I have a piece of code which reads as shown below: > > unless (open(IN, "in.txt")) { >die("Cannot open input file \n"); You should include the $!

Syswrite Function in Perl

2007-01-01 Thread Dharshana Eswaran
Hi All, I have a piece of code which reads as shown below: unless (open(IN, "in.txt")) { die("Cannot open input file \n"); } binmode(IN); unless (open(OUT, "+>output.txt")) { die("Cannot open input file input.txt\n"); } %structure = (1 => "A", 2 => "B", 3 => "C", );

Re: Perl Query - Conversion of EXE file

2006-12-06 Thread Dharshana Eswaran
On 12/7/06, Jenda Krynicky <[EMAIL PROTECTED]> wrote: From: "Dharshana Eswaran" <[EMAIL PROTECTED]> > Now suppose, a EXE for the Perl Program is created in Windows. > > > The input for the EXE has to be taken from the file provided by the > user.AndThe EXE

Re: Perl Query - Conversion of EXE file

2006-12-06 Thread Dharshana Eswaran
On 12/5/06, Jenda Krynicky <[EMAIL PROTECTED]> wrote: From: "kilaru rajeev" <[EMAIL PROTECTED]> > Jenda, > > I got a doubt here. Suppose the file does not contain any thing perl > code. If it contains only some data for configuration, is it possible > to include by using 'require' ? > > Rajeev

Re: Perl Query - Conversion of EXE file

2006-12-04 Thread Dharshana Eswaran
On 12/4/06, Jenda Krynicky <[EMAIL PROTECTED]> wrote: > > You are making it harder for yourself than you have to. Don't ZIP > > anything ... > > > > pp -o main.exe main.pl > > > > should be enough. And if the pp doesn't notice your main.pl uses > > subroutineX.pl then try > > > >

Re: Perl Query - Conversion of EXE file

2006-12-04 Thread Dharshana Eswaran
On 12/4/06, Jenda Krynicky <[EMAIL PROTECTED]> wrote: From: "Dharshana Eswaran" <[EMAIL PROTECTED]> > Hi Randal, > > I am trying to generate an exe file from few perl programs. > > I have 4 files which are main.pl, subroutine1.pl, subroutine2.pl and >

Re: Perl Query - Conversion of EXE file

2006-11-30 Thread Dharshana Eswaran
ov 2006 16:10:08 -0800, Randal L. Schwartz wrote: >>>>> ""Dharshana" == "Dharshana Eswaran" <[EMAIL PROTECTED]> writes: "Dharshana> I am in search of a way to convert Perl Program to EXE file. So that it can "Dharshana> be run any

Usage of PAR (Perl ARchive Toolkit)

2006-11-30 Thread Dharshana Eswaran
Hi all, I am trying to generate an exe file from few perl programs. I have 4 files which are main.pl, subroutine1.pl, subroutine2.pl and subroutine3.pl. main.pl file is the main program and it depends on the other subroutine files for data. So i tried zipping it using winzip and ran pp -o fol

Perl Query - Conversion of EXE file

2006-11-27 Thread Dharshana Eswaran
Hi All, I just have a query in Perl. I am in search of a way to convert Perl Program to EXE file. So that it can be run anywhere even without installing Perl. I searched the net and had mailed the beginners mailing list which suggested me a few tools like Perl2exe or Perl_Dev_Kit to do the sam

Re: How to make a perl program to an exe file

2006-11-21 Thread Dharshana Eswaran
r K.P -Original Message- From: kilaru rajeev [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 22, 2006 11:08 AM To: Dharshana Eswaran Cc: beginners@perl.org Subject: Re: How to make a perl program to an exe file Hi Dharsana, Please check this link. http://perldoc.perl.org/perlcc.html

Re: How to make a perl program to an exe file

2006-11-21 Thread Dharshana Eswaran
; like that. You can change Perl > files as the executable. > > rgds, > Rajeev > > > On 11/21/06, Dharshana Eswaran <[EMAIL PROTECTED] > wrote: > > > > Hi all, > > > > I have a perl program in a folder along with 2 more files associated > > to

Re: Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
On 11/17/06, Dr.Ruud <[EMAIL PROTECTED]> wrote: "Dr.Ruud" schreef: > my $data = join("\n", map {sprintf "%08b", $_} > map hex, =~ /[[:xdigit:]]+/g) . "\n" ; > > 1 while $data =~ s/(.+?)(.{7}\n.*)/$2$1/ ; Better: my $data = join "\n", map {sprintf "%08b", $_}

Re: Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
On 11/17/06, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: On 11/17/06, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Dharshana Eswaran wrote: > > > > On 11/16/06, Rob Dixon <[EMAIL PROTECTED] > wrote: > >> > >>>> Dharshana E

Re: Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
On 11/17/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Dharshana Eswaran wrote: > > On 11/16/06, Rob Dixon <[EMAIL PROTECTED]> wrote: >> >>>> Dharshana Eswaran wrote: >>>>> >>>>> I am working on the code below: >>>>> &g

Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
On 11/16/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Dharshana Eswaran wrote: > > On 11/16/06, Rob Dixon <[EMAIL PROTECTED] > wrote: >> >> Dharshana Eswaran wrote: >>> >>> I am working on the code below: >>> [snip irrelevancies] >>&

Re: Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
Thanks Jay. I will keep Perl on my system, up to date. Thanks and Regards, Dharshana On 11/16/06, Jay Savage <[EMAIL PROTECTED]> wrote: On 11/16/06, Rob Dixon <[EMAIL PROTECTED]> wrote: > Dharshana Eswaran wrote: [snip] > > my @fields = unpack '(A7)*', $binary;

Re: Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
On 11/16/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Dharshana Eswaran wrote: > > On 11/16/06, Rob Dixon <[EMAIL PROTECTED]> wrote: >> >> Dharshana Eswaran wrote: >>> >>> I am working on the code below: >>> [snip irrelevancies] >>&

Re: Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
shana On 11/16/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Dharshana Eswaran wrote: > Hi all, > > I am working on the code below: > > use strict; > use warnings; > > my %TypeofNumber = ( > '00' => Integer, > '01' => Floating, > &#

Perl - Joining of Binary values

2006-11-16 Thread Dharshana Eswaran
Hi all, I am working on the code below: use strict; use warnings; my %TypeofNumber = ( '00' => Integer, '01' => Floating, '10' => Char, '11' => Double ); my @hex = ("14", "2a", "11", "83"); $hex_length = @hex; for($i=0; $i<$hex_length; $i++) { my $binary = unpack 'B*', pack 'H*', $hex[$

How to define modules?

2006-11-14 Thread Dharshana Eswaran
Hi all, I have perl programs with me and i wish to convert it into perl modules. Can i know how to do the same? Or can i know any links or documents which describes the same? Thanks and Regards, Dharshana

Re: Perl - Bit Manipulation

2006-11-13 Thread Dharshana Eswaran
Hi all, In the below program, i give in the hash as %TypeofNumber = ( 0b00 => Integer, 0b01 => Floating, 0b10 => Char, 0b11 => Double ); Using this hash i need to priont the appropriate combination How to do that? Thanks and Regards, Dharshana On 11/13/06, Dharshana Esw

Perl - Bit Manipulation

2006-11-12 Thread Dharshana Eswaran
Hi all, I am working on the code below use strict; use warnings; my $hex = "43"; my $binary = unpack 'B*', pack 'H*', $hex; print "$binary\n\n"; my @fields = unpack 'A2A2A4', $binary; my $i; printf "%-4s => %s\n", $fields[$i++], $_ foreach qw/Ext TypeofNumber NumberingPlan/; **OUTPUT**

Re: parsing of 8bit binary data bitwise

2006-11-09 Thread Dharshana Eswaran
Rob, my $i; printf "%-4s => %s\n", $fields[$i++], $_ foreach qw/abc def lmn/; These are arbitrary values. Thanks for the kind and immediate response. I sincerely appreciate it. Thanks and Regards, Dharshana On 11/9/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Dharshana Eswa

Re: parsing of 8bit binary data bitwise

2006-11-09 Thread Dharshana Eswaran
you what to convert 0=> abc,. Can I know a little bit more. Rajeev On 11/9/06, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > > Hi all, > > I wanted to know how to parse a 8bit binary data bitwise? > > I have my input in hex and i convert it into binary form using th

parsing of 8bit binary data bitwise

2006-11-09 Thread Dharshana Eswaran
Hi all, I wanted to know how to parse a 8bit binary data bitwise? I have my input in hex and i convert it into binary form using the following logic: %h2b = (0 => "", 1 => "0001", 2 => "0010", 3 => "0011", 4 => "0100", 5 => "0101", 6 => "0110", 7 => "0111", 8 => "1000", 9 => "1001", a => "1

Conversion of Hex bytes to binary and vice versa

2006-11-09 Thread Dharshana Eswaran
Hi all, I have to convert a hex byte [eg: 0x2A] into its binary form [eg:00101010]. The input is always only one byte that is 8 bits. I tried using pack() and unpack(). But i am unable to get desired results. The desired output should look like the following: 0x0a => 1010 0x23 => 00100011

Parsing of HEX bytes using PErl

2006-10-24 Thread Dharshana Eswaran
Hi all, I am a student working on a project using Perl. My work is... I have few hex bytes as inputs for my program. Its a series of hex bytes. for eg: 01 0a ab 2a 1c etc... Here each byte stands for some representation. I also have a data file in which all the representations are stored. For

Plz HELP

2006-10-17 Thread Dharshana Eswaran
Hi All, I am a student who is working on Perl on my project. I am a beginner in Perl. I know how to read the data from files into a variable or array. I mean, i know to read the data line by line into a varaiable or teh full file contents into an array. But, i have stored few hex bytes in the