Sponsored Content
Top Forums Shell Programming and Scripting Perl: array, assigning multi-word sentences with quotes Post 302232333 by kahuna on Thursday 4th of September 2008 09:39:46 AM
Old 09-04-2008
I'm not sure this is better, but it at least gets rid of the backslashes.
Code:
my @arrayquotes = ('"An Apple a day keeps the doctor away"', '"Procastination is the thief of time"');

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl: Assigning array values..

I have to add a variable value to an array, something like this: ...... @my_array_name = $value_of_this_variable; This doesnt seem to work, any ideas why? Thanks! (4 Replies)
Discussion started by: looza
4 Replies

2. Shell Programming and Scripting

Assigning the values to an Array

hi every body, i donot know how to assign a array varible with a file see i having file more file property1 Name property2 Address the above two line are tab Space seperated between the property and its value i want to seperate it and assign to... (1 Reply)
Discussion started by: kkraja
1 Replies

3. Programming

How to extract a sentences of word from a text file.

Hi , i have a text file that contain a story How do i extract the out all the sentences that contain the word Mon. in C++ I only want to show those sentences that contain the word mon eg. Monkey on a tree. Rabbit jumping around the tree. I am very rich, I have lots of money. Today... (1 Reply)
Discussion started by: xiaojesus
1 Replies

4. Shell Programming and Scripting

How to match all array contents and display all highest matched sentences in perl?

Hi, I have an array with 3 words in it and i have to match all the array contents and display the exact matched sentence i.e all 3 words should match with the sentence. Here are sentences. $arr1="Our data suggests that epithelial shape and growth control are unequally affected depending... (5 Replies)
Discussion started by: vanitham
5 Replies

5. Shell Programming and Scripting

Perl : Search for next occurence of a word in an array

I have an array as follows: Space: ABC Name: def Age: 22 Type: new Name: fgh Age: 34 Type: old Space: XYZ Name: pqr Age: 44 Type: new : : How can I separate the array with elements starting from Space:ABC until Space: XYZ & put them in a different array & so on... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

6. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable so...eg...let take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

7. UNIX for Dummies Questions & Answers

extracting sentences that only contain a word

Hi guys Need your help how do I extract sentences with only a word i.e. today is hot hot very humid humid2 Sample output hot very (0 Replies)
Discussion started by: jamestan
0 Replies

8. Shell Programming and Scripting

extracting sentences that only contain a word

Hi guys Need your help how do I extract sentences with only a word i.e. today is hot hot very humid humid2 Sample output hot (6 Replies)
Discussion started by: jamestan
6 Replies

9. Shell Programming and Scripting

Reading from a file and assigning to an array in perl

I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value. I was thinking the best way to... (1 Reply)
Discussion started by: billprice13
1 Replies

10. Shell Programming and Scripting

Perl : Assigning multile hash values to a single array

I know that @food = %fruit; Works. But how do I assign %fruit and %veggies to @food ? (2 Replies)
Discussion started by: popeye
2 Replies
STRIPSLASHES(3) 							 1							   STRIPSLASHES(3)

stripslashes - Un-quotes a quoted string

SYNOPSIS
string stripslashes (string $str) DESCRIPTION
Un-quotes a quoted string. Note If magic_quotes_sybase is on, no backslashes are stripped off but two apostrophes are replaced by one instead. An example use of stripslashes(3) is when the PHP directive magic_quotes_gpc is on (it was on by default before PHP 5.4), and you aren't inserting this data into a place (such as a database) that requires escaping. For example, if you're simply outputting data straight from an HTML form. PARAMETERS
o $str - The input string. RETURN VALUES
Returns a string with backslashes stripped off. ( ' becomes ' and so on.) Double backslashes ( \) are made into a single backslash ( ). EXAMPLES
Example #1 A stripslashes(3) example <?php $str = "Is your name O'reilly?"; // Outputs: Is your name O'reilly? echo stripslashes($str); ?> Note stripslashes(3) is not recursive. If you want to apply this function to a multi-dimensional array, you need to use a recursive func- tion. Example #2 Using stripslashes(3) on an array <?php function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } // Example $array = array("f\'oo", "b\'ar", array("fo\'o", "b\'ar")); $array = stripslashes_deep($array); // Output print_r($array); ?> The above example will output: Array ( [0] => f'oo [1] => b'ar [2] => Array ( [0] => fo'o [1] => b'ar ) ) SEE ALSO
addslashes(3), get_magic_quotes_gpc(3). PHP Documentation Group STRIPSLASHES(3)
All times are GMT -4. The time now is 09:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy