Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Help please, or Urgent help needed!

by SuicideJunkie (Vicar)
on Mar 27, 2012 at 18:55 UTC ( #961998=note: print w/replies, xml ) Need Help??

in reply to Help please, or Urgent help needed!

...ldifgrep line 59...

I don't see a print on line 59 out of 36 of your code listing. Perhaps you aren't running the script you think you are running?

To debug uninitialized warnings, try putting an if statement near the line in question; if (not defined $var) then print out all of your variables to see why the value became undefined in the first place.

Replies are listed 'Best First'.
Re^2: Help please, or Urgent help needed!
by anakin30 (Acolyte) on Mar 27, 2012 at 19:55 UTC

    i have re-updated perl script code, pointing line to for the error..

      How about reading with block. If you set input separator with empty string, you will get block.
      #!/usr/bin/perl use strict; use warnings; open( my $fh, '<', "ldif.file") or die $!; $/=""; while( my $item=<$fh> ){ print "===========\n"; print "$item\n"; print "===========\n"; if ($item =~ /something/is ){ print "as you like\n"; } } close $fh; __DATA__ =========== dn: uid=testing,ou=comp, dpwnc: BH mail: sn: example =========== =========== dn: uid=testing1,ou=comp, dpwnc: CH mail: sn: example1 =========== =========== dn: uid=testing2,ou=comp, dpwnc: DH mail: sn: example2 ===========

        I wish to print output as below, can you please explain more detail how i can get this output?" meanwhile i appreciate if you could tell me what do you mean by print "as you like"?

        I'm still beginner in perl scripting, couldn't get it. I'm sorry. Please explain further.

        dn: uid=testing,ou=comp, mail: dn: uid=testing1,ou=comp, mail: dn: uid=testing2,ou=comp, mail:

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://961998]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2018-03-24 16:12 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.