Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

To remove duplicates inside a string

by Anonymous Monk
on Jun 29, 2013 at 06:09 UTC ( #1041396=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I have a doubt on how to delete duplicate paragraphs from inside a string. I can delete the immediate predecessor from a line but I am failing in this case, as this is a paragraph which is duplicating. Can any Monks kindly guide me on this issue pls...

Thank you!

$string = ' 75160 true 75160 false Submission for the position: Chef De Partie - (Job Number: HLT00016) false 75160 false true https://frhi.taleo.net/careersection/jobdetail.ftl?job=75160&lang=en Chef De Partie true Chef De Partie Egypt-Cairo-Fairmont Towers, Heliopolis Egypt-Cairo-Fairmont Towers, Heliopolis Regular Regular !*! [IMAGE] Chef de Partie Every memorable dining experience at Fairmont Hotels and Resorts begins behind the scenes with our Culinary team’s commitment to saf +e, efficient operations and exceptional cuisine. Your passion for managing food preparation as Chef de Partie will inspire your team +to create truly spectacular fare. Hotel Overview:At the heart of Cairo +’s diplomatic and presidential neighborhood, a few minutes away from Cairo International Airport elegantly stands the Fairmont Heliopoli +s &Towers Hotel. It boasts 835 lavish guest rooms and suites, 19 superlative dining options, 69 thousand square feet of banquet spac +e and a unrivalled range of recreational & Spa facilities. The design + of Fairmont, Heliopolis & Towers Hotel comprises a unique mix of contemporary art and authentic décor that echoes modern Cairo along with the distinct Egyptian heritage. Summary of Responsibilities: Reporting to the Sous Chef, responsibilities and essential job functions include but are not limited to the following: * Consistently offer professional, friendly and proactive guest service while supporting fellow Colleagues * Ensure the consistency in the preparation of all food items for + a la carte andor buffet menus according to hotel recipes and standards * Actively share ideas, opinions and suggestions in daily shift briefings * Ensure all kitchen Colleagues are aware of standards and expectations * Liaise daily with Outlet Chefs to keep open lines of communicat +ion regarding guest feedback * Continually strive to improve food preparation and presentation +s * Maintain proper rotation of product in all chillers to minimize wastage/spoilage * Have full knowledge of all menu items, daily features and promotions * Ensure the cleanliness and maintenance of all work areas, utensils, and equipment * Follow kitchen policies, procedures and service standards * Follow all safety and sanitation policies when handling food an +d beverage * Other duties as assigned !*! [IMAGE] Chef de Partie Every memorable dining experience at Fairmont Hotels and Resorts begins behind the scenes with our Culinary team’s commitment to saf +e, efficient operations and exceptional cuisine. Your passion for managing food preparation as Chef de Partie will inspire your team +to create truly spectacular fare. Hotel Overview:At the heart of Cairo +’s diplomatic and presidential neighborhood, a few minutes away from Cairo International Airport elegantly stands the Fairmont Heliopoli +s &Towers Hotel. It boasts 835 lavish guest rooms and suites, 19 superlative dining options, 69 thousand square feet of banquet spac +e and a unrivalled range of recreational & Spa facilities. The design + of Fairmont, Heliopolis & Towers Hotel comprises a unique mix of contemporary art and authentic décor that echoes modern Cairo along with the distinct Egyptian heritage. Summary of Responsibilities: Reporting to the Sous Chef, responsibilities and essential job functions include but are not limited to the following: * Consistently offer professional, friendly and proactive guest service while supporting fellow Colleagues * Ensure the consistency in the preparation of all food items for + a la carte andor buffet menus according to hotel recipes and standards * Actively share ideas, opinions and suggestions in daily shift briefings * Ensure all kitchen Colleagues are aware of standards and expectations * Liaise daily with Outlet Chefs to keep open lines of communicat +ion regarding guest feedback * Continually strive to improve food preparation and presentation +s * Maintain proper rotation of product in all chillers to minimize wastage/spoilage * Have full knowledge of all menu items, daily features and promotions * Ensure the cleanliness and maintenance of all work areas, utensils, and equipment * Follow kitchen policies, procedures and service standards * Follow all safety and sanitation policies when handling food an +d beverage * Other duties as assigned !*!Qualifications: * Previous experience in the Culinary field required * Journeyman’s papers or international equivalent required * DiplomaCertification in a Culinary discipline an asset * Computer literate in Microsoft Window applications an asset * Strong interpersonal and problem solving abilities * Highly responsible & reliable * Ability to work well under pressure in a fast paced environment * Ability to work cohesively as part of a team * Ability to focus attention on guest needs, remaining calm and courteous at all times Physical Aspects of Position (include but are not limited to): * Constant standing and walking throughout shift * Frequent lifting and carrying up to 30 lbs * Occasional kneeling, pushing, pulling, lifting * Occasional ascending or descending ladders, stairs and ramps Visa Requirements: Must be eligible / permitted to work in Egypt APPLY TODAY: Whether you’re launching your career or seeking meaningful employment, we invite you to visit www.fairmontcareers.c +om to learn more about Fairmont Hotels & Resorts—and the extraordinary opportunities that exist! ABOUT FAIRMONT HOTELS & RESORTS At Fairmo +nt Hotels & Resorts we offer our guests the finest hospitality experie +nce in each of our destinations. And we know that, to offer our guests +the best, we first need to offer our employees the best. That’s why you +'ll find exceptional work opportunities—throughout North America and th +e Caribbean, Europe and Africa, the Middle East and Asia Pacific—as w +ell as industry-leading training, career development, recognition and rewards. Fairmont Hotels & Resorts is a celebrated collection of hotels that includes landmark locations like London’s The Savoy, Ne +w York’s The Plaza, and Shanghai’s Fairmont Peace Hotel. Our teams ar +e guided by values of Respect, Integrity, Teamwork and Empowerment; w +e employ the highest ethical and quality standards, treating all colleagues with fairness and dignity. A community and environmental leader, Fairmont is also regarded for its responsible tourism practices and award-winning Green Partnership program. An exciting future awaits! !*!Qualifications: * Previous experience in the Culinary field required * Journeyman’s papers or international equivalent required * DiplomaCertification in a Culinary discipline an asset * Computer literate in Microsoft Window applications an asset * Strong interpersonal and problem solving abilities * Highly responsible & reliable * Ability to work well under pressure in a fast paced environment * Ability to work cohesively as part of a team * Ability to focus attention on guest needs, remaining calm and courteous at all times Physical Aspects of Position (include but are not limited to): * Constant standing and walking throughout shift * Frequent lifting and carrying up to 30 lbs * Occasional kneeling, pushing, pulling, lifting * Occasional ascending or descending ladders, stairs and ramps Visa Requirements: Must be eligible / permitted to work in Egypt APPLY TODAY: Whether you’re launching your career or seeking meaningful employment, we invite you to visit www.fairmontcareers.c +om to learn more about Fairmont Hotels & Resorts—and the extraordinary opportunities that exist! ABOUT FAIRMONT HOTELS & RESORTS At Fairmo +nt Hotels & Resorts we offer our guests the finest hospitality experie +nce in each of our destinations. And we know that, to offer our guests +the best, we first need to offer our employees the best. That’s why you +'ll find exceptional work opportunities—throughout North America and th +e Caribbean, Europe and Africa, the Middle East and Asia Pacific—as w +ell as industry-leading training, career development, recognition and rewards. Fairmont Hotels & Resorts is a celebrated collection of hotels that includes landmark locations like London’s The Savoy, Ne +w York’s The Plaza, and Shanghai’s Fairmont Peace Hotel. Our teams ar +e guided by values of Respect, Integrity, Teamwork and Empowerment; w +e employ the highest ethical and quality standards, treating all colleagues with fairness and dignity. A community and environmental leader, Fairmont is also regarded for its responsible tourism practices and award-winning Green Partnership program. An exciting future awaits! Colleague Colleague Full-time Full-time Rotating / Shift Work Rotating / Shift Work Ongoing Ongoing HLT00016 HLT00016 false 75160 75160 true 75160 false Submission for the position: Chef De Partie - (Job Number: HLT00016) false 75160 false true https://frhi.taleo.net/careersection/jobdetail.ftl?job=75160&lang=en Chef De Partie true ';

Comment on To remove duplicates inside a string
Download Code
Re: To remove duplicates inside a string
by Athanasius (Monsignor) on Jun 29, 2013 at 08:13 UTC

    This script deletes all duplicate paragraphs:

    #! perl use strict; use warnings; my $string = do { $/ = undef; <DATA>; }; my @original = split /\n\n+/, $string; my @unique; OUTER: for my $orig (@original) { $orig eq $_ && next OUTER for @unique; push @unique, $orig; } print join("\n\n", @unique); __DATA__ 75160 etc.

    Is that what you wanted? If not, you will need be more specific, and also show the desired output.

    Hope that helps,

    Update: ++hdb (when the Vote Fairy next visits) for the note on paragraph mode, below.

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      One remark: setting $/="" (paragraph mode) avoids the two step reading of the file:

      my @original = do { $/ = ""; <DATA>; };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1041396]
Approved by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-09-19 02:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls