home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!male.EBay.Sun.COM!exodus.Eng.Sun.COM!cleo.Eng.Sun.COM!tesh
- From: tesh@cleo.Eng.Sun.COM (Teshager Tesfaye)
- Newsgroups: comp.lang.perl
- Subject: Help on string match!
- Date: 18 Dec 1992 21:07:40 GMT
- Organization: Sun Microsystems, Inc. Mt. View, Ca.
- Lines: 45
- Distribution: na
- Message-ID: <lj4fcsINN1lu@exodus.Eng.Sun.COM>
- Reply-To: tesh@cleo.Eng.Sun.COM (Teshager Tesfaye)
- NNTP-Posting-Host: cleo
-
-
- I have two "Big" files that I read into arrays:
- File A - contains the string to be matched
- File B - is the file on which the match is performed on.
-
- Task:
-
- I want to match each string in A inside B and append string,
- STRING, after the match. So my final file C, should be a copy
- of B with inserted STRING's .
-
- The following is the approach I took but did not work:
-
- foreach $a_name ( @A_array ) {
- for(;;) {
-
- if( $_ =~ "^ +[JKD]FF" ) {
- local($macname,$fname_net,$other) = split(' ',$_,3);
-
- -------> if ( $a_name eq $flop_name ) {
-
- # do something
-
- &add_str_routine( x );
- last;
- }
-
- else {
- next;
- }
- }
- }
-
-
- I am having with the string match on the line that I show. Although
- I know that $a_name and $flop_name are identical strings this string
- match "ALWAYS" fails. Am I doing something wrong? Is there a better
- way to go about this problem.
-
- Thanks in advance.
-
- Tesh.
-
-
-
-