473,626 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Want to remove an unwanted charachter from scalar

2 New Member
I am reading in a file that has a list that of items. The items I place into a scalar for print but when i do, there is an extra unwanted charachter that shows up at the end of each item. It looks to be some hex charachter. It does not exist in the original file. Is this some sort of charachter set and can I remove it with a substition routine?

I have tried

$item =~ s/\x+$//g;

and

$item =~ s/[\n+\r+\f+\e+\t+]//g;

but they do not help.



Any help would be great in identifying and removing this. Thanks. -ljs
Apr 21 '08 #1
4 1581
KevinADC
4,059 Recognized Expert Specialist
are you using chomp()? If so the file was probably created on a different operating system and the line endings are differnt than the operating sytem the script is running on. You can try:

$item =~ s/[\r\n]?$//;

see if that helps.
Apr 21 '08 #2
ljsmith91
2 New Member
KevinADC,

Thanks. However, it didn't make a difference.

I think the extra charachter is a <160> or char set for &nbsp. However, even knowing that, I can't seem to get rid of it.

Any ideas that might help?

Thanks.
Apr 22 '08 #3
KevinADC
4,059 Recognized Expert Specialist
is $item a multiline scalar? In other words, does it have embedded records seperators like newlines in it? If so you can try this:

$item =~ s/[\r\n]?$//m;

If not, I am not sure what else to suggest.
Apr 22 '08 #4
Ganon11
3,652 Recognized Expert Specialist
You could try getting the item (weird character and all), then capturing the legible portion:

Expand|Select|Wrap|Line Numbers
  1. $item =~ /([A-Za-z]+)/;
  2. $item = $1;
If the item could be multiple words, add spaces - if the item includes numbers, inclue 0-9, etc. etc.
Apr 22 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
1086
by: roger | last post by:
I'm having difficulties invoking a user defined table function, when passing to it a parameter that is the result of another user defined function. My functions are defined like so: drop function dbo.scalar_func go create function dbo.scalar_func() returns int
11
3070
by: Tony Johansson | last post by:
Hello! I have some problem with STL function remove I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper class for a primitive int with some methods. I don't show the Integer class because it will not add any information to my problem. Main is using some STL function Now to my problem.
5
1677
by: Bob Stearns | last post by:
When I run the following query with the two sections commented out, the response time is between 1 an 2 seconds; with the first indicated section enabled, the response goes up to 15 seconds even though t1.bh_disposal_code IS NOT NULL in only one row; with the second section enabled, it goes up to 592 seconds, even though t1.mating is NULL in all the rows chosen. Why should the (supposedly never executed) scalar subqueries cost so much? It...
3
7849
by: Danny Yeadon | last post by:
Hi I need to remove unwanted characters from phone numbers from my phone bill to analyse the data. Some examples are 02 48222222 i need to remove the space +61266667656 i need to remove the + 0427 221 529 i need to remove both spaces 0419 637 344MNET i need to remove the spaces and the MNET telstra.wap i need to remove all of this +61408400510MNE ...
10
6759
by: pamelafluente | last post by:
Hi I have a sorted list with several thousands items. In my case, but this is not important, objects are stored only in Keys, Values are all Nothing. Several of the stored objects (might be a large number) have to be removed (say when ToBeRemoved = true). class SomeObj ToBeRemoved be a boolean field end class
4
4446
by: Magnus Warker | last post by:
Hello group, I am producing a form within a table: <table> <tr> <td> <form> ... </form>
0
1918
by: Michel Esber | last post by:
Hello, Linux RedHat AS4 running DB2 V8 FP15. I have very large tables (100 Million+ rows), and I only need to keep 6 months of data online/available. The tables have a timestamp field. I was hoping that DB2 High Performance Unload V3 allow me to 'extract and delete' data from tablespaces very quickly, but unfortunately it is only able to extract/export data (much faster than regular 'export'
3
5585
by: Barkingmadscot | last post by:
I am stuck, i can workout how to remove lines from an array I have loading a text file (a Log), I know which lines a need, but the logs can be upto 30K sometimes bigger. I found trying to delete the lines from the log file before loading in the array took ages, i thought i would be alot quicker to put in an array and remove the unwanted lines. Dim text As Array Dim lines As New List(Of String)
6
2699
by: ashish1985s | last post by:
Hello friends.. i have made on window service which is hourly update the rss news data.. but some rss comes with some ads and logos and unwanted scripts i wanted to completly remove that all unwanted things.. Should any one suggest me right way to do this..?? Thanks for think on it..!!
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.