in reply to Best way to sort these strings ? recursive way ? use Parse::RecDescent?

Best way to sort these strings ? recursive way ? use Parse::RecDescent?

I don't see anything recursive about it and this is certainly not a job for Parse::RecDescent.

Have you actually tried anything here? Got code?

I'd approach this by building a data structure from all the input before outputting it. Knowing nothing more about your input than the sample you've provided, I'd use a structure that looked like this when complete:

{ 'EX1J' => { 'desc' => 'JOB1' 'pred' => [], }, 'EX2J' => { 'desc' => 'JOB2' 'pred' => [], }, 'EX3J' => { 'desc' => 'JOB3' 'pred' => ['EX1J'], }, 'EX4J' => { 'desc' => 'JOB3' 'pred' => ['EX1J', 'EX2J'], }, }
The code to do that would be pretty straight forward. Is this enough to get you started?

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Best way to sort these strings ? recursive way ? use Parse::RecDescent?
  • Download Code